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>
using namespace std;
long long gcd(long long ar1, long long ar2) {
  return ar2 == 0 ? ar1 : gcd(ar2, ar1 % ar2);
}
long long add(long long ar1, long long ar2, long long m = 1000000007) {
  if (ar1 >= m) ar1 %= m;
  if (ar2 >= m) ar2 %= m;
  if (ar1 < 0) ar1 += m;
  if (ar2 < 0) ar2 += m;
  long long res = ar1 + ar2;
  if (res >= m or res <= -m) res %= m;
  if (res < 0) res += m;
  return res;
}
long long mul(long long ar1, long long ar2, long long m = 1000000007) {
  if (ar1 >= m) ar1 %= m;
  if (ar2 >= m) ar2 %= m;
  if (ar1 < 0) ar1 += m;
  if (ar2 < 0) ar2 += m;
  long long res = ar1 * ar2;
  if (res >= m or res <= -m) res %= m;
  if (res < 0) res += m;
  return res;
}
long long pow_mod(long long ar1, long long ar2, long long m = 1000000007) {
  long long res = 1;
  ar1 = ar1 % m;
  while (ar2) {
    if (ar2 & 1) res = mul(res, ar1, m);
    ar2 >>= 1;
    ar1 = mul(ar1, ar1, m);
  }
  return res;
}
long long fastexp(long long ar1, long long ar2) {
  long long res = 1;
  while (ar2) {
    if (ar2 & 1) res = res * ar1;
    ar2 >>= 1;
    ar1 *= ar1;
  }
  return res;
}
long long gcdExtendido(long long ar1, long long ar2, long long *x,
                       long long *y) {
  if (ar1 == 0) {
    *x = 0;
    *y = 1;
    return ar2;
  }
  long long x1, y1;
  long long gcd = gcdExtendido(ar2 % ar1, ar1, &x1, &y1);
  *x = y1 - (ar2 / ar1) * x1;
  *y = x1;
  return gcd;
}
long long modInverso(long long ar1, long long m) {
  long long x, y;
  long long g = gcdExtendido(ar1, m, &x, &y);
  if (g != 1)
    return -1;
  else
    return (x % m + m) % m;
}
long long isPrime(long long n) {
  if (n == 1) return 0;
  if (n == 2) return 1;
  if ((n % 2) == 0) return 0;
  for (long long i = 3; i <= sqrt(n); i += 2) {
    if (n % i == 0) return 0;
  }
  return 1;
}
bool sortbysec(const pair<long long, long long> &ar1,
               const pair<long long, long long> &ar2) {
  return (ar1.first < ar2.first);
}
long long fact(long long n) {
  if (n <= 1) return 1;
  return mul(n, fact(n - 1), 1000000007);
}
vector<long long> store;
void seive(long long n) {
  vector<long long> prime;
  for (long long i = 0; i <= 10000000; i++) {
    prime.push_back(1);
  }
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p]) {
      for (long long i = p * p; i <= n; i += p) prime[i] = 0;
    }
  }
  for (long long i = 2; i < n; i++) {
    if (prime[i]) store.push_back(i);
  }
}
long long binarySearch(long long low, long long high, vector<long long> a,
                       long long key) {
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (a[mid] < key) {
      low = mid + 1;
    } else if (a[mid] > key) {
      high = mid - 1;
    } else {
      return mid;
    }
  }
  return -1;
}
long long binarySearch1(long long low, long long high,
                        vector<pair<long long, long long> > a, long long key) {
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (a[mid].first < key) {
      low = mid + 1;
    } else if (a[mid].first > key) {
      high = mid - 1;
    } else {
      return mid;
    }
  }
  return -1;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, x;
  cin >> n >> x;
  map<long long, long long> m1, m2;
  long long a[n];
  for (long long i = 1; i <= 100000; i++) {
    m1[i] = 0;
    m2[i] = 0;
  }
  long long ans = -1;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (m1[a[i]] == 0)
      m1[a[i]] = 1;
    else
      ans = 0;
  }
  if (ans == 0) {
    cout << ans << '\n';
  } else {
    for (long long i = 0; i < n; i++) {
      if (m1[a[i] & x] == 1 && (a[i] & x) != a[i]) {
        ans = 1;
        break;
      }
    }
    if (ans == 1) {
      cout << ans << '\n';
    } else {
      for (long long i = 0; i < n; i++) {
        if (m2[a[i] & x] == 1) {
          ans = 2;
          break;
        }
        if (m2[a[i] & x] == 0) m2[a[i] & x] = 1;
      }
      cout << ans << '\n';
    }
  }
  return 0;
}
