Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, x;
- cin >> n >> x;
- int mn = 101;
- int mx = -1;
- for(int i = 0; i < n; i++) {
- int a;
- cin >> a;
- if(a == x) {
- cout << 1 << endl;
- return 0;
- }
- mn = min(mn, a);
- mx = max(mx, a);
- }
- cout << ((x > mn and x < mx) ? 2 : -1) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement