fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define nada "\n"
  5. const int N = 3e5 + 20;
  6. const double pi = 3.141592653;
  7. void fast()
  8. {
  9. ios::sync_with_stdio(0);
  10. cin.tie(0);
  11. cout.tie(0);
  12. }
  13.  
  14. int main()
  15. {
  16. fast();
  17. //cout<<fixed<<setprecision(6);
  18. ll n,k,a;
  19. cin>>a>>n;
  20. k=-n;
  21. ll arr[2*100000];
  22. for(int i=0; i<a; i++)
  23. {
  24. cin>>arr[i];
  25. }cout<< k<<"\n";
  26. sort(arr,arr+a);
  27. for(int i=0; i<a; i++)
  28. {
  29.  
  30. if(arr[i]!=k)
  31. {
  32. cout<<k;
  33. break;
  34. }
  35. else
  36. {
  37. k++;
  38. }
  39. }
  40.  
  41. }
Success #stdin #stdout 0s 4392KB
stdin
Standard input is empty
stdout
0