There is an array with n elements a1, a2, ..., an and the number x.

In one operation you can select some i (1 ≤ i ≤ n) and replace element ai with ai & x, where & denotes the [bitwise and](https://en.wikipedia.org/wiki/Bitwise_operation#AND) operation.

You want the array to have at least two equal elements after applying some operations (possibly, none). In other words, there should be at least two distinct indices i ≠ j such that ai = aj. Determine whether it is possible to achieve and, if possible, the minimal number of operations to apply.

Input

The first line contains integers n and x (2 ≤ n ≤ 100 000, 1 ≤ x ≤ 100 000), number of elements in the array and the number to and with.

The second line contains n integers ai (1 ≤ ai ≤ 100 000), the elements of the array.

Output

Print a single integer denoting the minimal number of operations to do, or -1, if it is impossible.

Examples

Input

4 3
1 2 3 7


Output

1


Input

2 228
1 1


Output

0


Input

3 7
1 2 3


Output

-1

Note

In the first example one can apply the operation to the last element of the array. That replaces 7 with 3, so we achieve the goal in one move.

In the second example the array already has two equal elements.

In the third example applying the operation won't change the array at all, so it is impossible to make some pair of elements equal.
#include <bits/stdc++.h>
namespace uchiha {
using namespace std;
template <class T>
using v = vector<T>;
template <class T>
using vv = vector<v<T>>;
template <class T>
using pri = priority_queue<T>;
template <class T>
using rpi = priority_queue<T, v<T>, greater<T>>;
using vc = v<char>;
using vs = v<string>;
using vd = v<long double>;
using vvi = v<vector<long long>>;
using vvb = v<vector<bool>>;
using vvd = v<vd>;
template <class T>
inline void rd(T& a) {
  cin >> a;
}
template <class T>
inline void rd(v<T>& a) {
  T x;
  for (long long i = (long long)0; i < (long long)a.size(); i++) {
    cin >> x;
    a[i] = x;
  }
}
template <class T>
inline void rd(vv<T>& a) {
  for (long long i = (long long)0; i < (long long)a.size(); i++) {
    rd(a[i]);
  }
}
template <class T, class U>
inline void rd(pair<T, U>& p) {
  cin >> p.first >> p.second;
}
template <class T, class... Args>
inline void rd(T& a, Args&... args) {
  cin >> a;
  rd(args...);
}
template <class T>
inline void print(T a) {
  cout << (a) << endl;
}
template <class T>
inline void print(v<T> a) {
  for (auto x : a) cout << (x) << ' ';
  cout << endl;
}
template <class T>
inline void print(vv<T> a) {
  for (auto x : a) print(x);
}
template <class T>
inline void print(set<T> a) {
  for (auto it = a.begin(); it != a.end(); it++) cout << (*it) << ' ';
  cout << endl;
}
template <class T, class U>
inline void print(pair<T, U>& p) {
  cout << p.first << ' ' << p.second << endl;
}
template <class T, class... Args>
inline void print(T& a, Args&... args) {
  cout << a << ' ';
  print(args...);
}
inline long long mintwo(long long n) { return __builtin_ctzll(n); }
inline long long maxtwo(long long n) { return (long long)log2(n); }
inline long long onebits(long long n) { return __builtin_popcountll(n); }
inline long long ceil(long long a, long long b) { return (a + b - 1) / b; }
inline void mangekyo();
inline void subl() {}
long double _c = clock();
using i32 = int32_t;
template <class T>
inline T sum(v<T> a) {
  T s = 0;
  for (auto x : a) s += x;
  return s;
}
template <class T>
inline T min(v<T> a) {
  return *min_element((a).begin(), (a).end());
}
template <class T>
inline T max(v<T> a) {
  return *max_element((a).begin(), (a).end());
}
template <class T, class U>
inline long double pdiv(T a, U b) {
  return (1.0 * (a)) / (1.0 * (b));
}
template <class T>
inline void chxor(T& a, T b) {
  a = a ^ b;
}
template <class T, class U>
inline void chmax(T& a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
inline void chmin(T& a, U b) {
  if (a > b) a = b;
}
template <class T, class U>
inline T max(T a, U b) {
  return a > b ? a : b;
}
template <class T, class U>
inline T min(T a, U b) {
  return a < b ? a : b;
}
template <class T>
v<T> pre_sum(v<T> a) {
  for (long long i = (long long)1; i < (long long)a.size(); i++)
    a[i] += a[i - 1];
  return a;
}
template <class T>
v<T> suf_sum(v<T> a) {
  for (long long i = (long long)a.size() - 1 - 1; i > (long long)0 - 1; i--)
    a[i] += a[i + 1];
  return a;
}
template <class T, class U>
T POW(T x, T y, U m) {
  T a = 1;
  while (y) {
    if (y & 1) a = (a * x) % m;
    x = (x * x) % m;
    y >>= 1;
  }
  return a;
}
inline bool tle() {
  bool b = (((clock() - _c) / CLOCKS_PER_SEC) > 3);
  if (b) cerr << "TLE";
  return b;
}
inline void yes() { print("YES"); }
inline void no() { print("NO"); }
template <class T>
class Queue {
  queue<T> q;

 public:
  void push(T x) { q.push(x); }
  void pop() { q.pop(); }
  void clear() {
    while (!q.empty()) {
      q.pop();
    }
  }
  bool empty() { return q.empty(); }
  T top() { return q.front(); }
  T back() { return q.back(); }
  T size() { return q.size(); }
  T out() {
    long long u = q.front();
    q.pop();
    return u;
  }
};
template <class T>
class Stack {
  stack<T> s;

 public:
  void push(T x) { s.push(x); }
  void pop() { s.pop(); }
  void clear() {
    while (!s.empty()) {
      s.pop();
    }
  }
  bool empty() { return s.empty(); }
  T top() { return s.top(); }
  T size() { return s.size(); }
  T out() {
    long long u = s.top();
    s.pop();
    return u;
  }
};
}  // namespace uchiha
using namespace uchiha;
const long long inf = 1e18, mod = 1e9 + 7;
long long fun() {
  long long n, k;
  rd(n, k);
  vector<long long> a(n);
  rd(a);
  map<long long, long long> fre;
  for (auto x : a) fre[x]++;
  for (auto x : a) {
    if (fre[x] > 1) return 0;
  }
  for (auto x : a) {
    long long val = x & k;
    if (val == x) {
      if (fre[x] > 1) return 1;
    } else {
      if (fre[val]) return 1;
    }
  }
  vector<long long> b = a;
  for (long long i = (long long)0; i < (long long)n; i++) b[i] = b[i] & k;
  map<long long, long long> freb;
  for (auto x : b) {
    if (freb[x]) return 2;
    freb[x]++;
  }
  return -1;
}
i32 main() {
  mangekyo();
  cout << fun();
  cerr << "Time: " << ((clock() - _c) / CLOCKS_PER_SEC);
  ;
  return 0;
}
void uchiha::mangekyo() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  srand(time(NULL));
  subl();
}
