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.
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

@SuppressWarnings("unchecked")
public class P1013B {

  public void run() throws Exception {
    int n = nextInt(), x = nextInt(), aa [] = new int [n];

    Map<Integer, Integer> ac = new LinkedHashMap();
    for (int i = 0; i < n; i++) {
      aa[i] = nextInt();
      
      if (ac.containsKey(aa[i])) {
        println(0);
        return;
      }

      ac.put(aa[i], ac.getOrDefault(aa[i], 0) + 1);
    }

    for (int a : aa) {
      int c = ac.get(a) - 1;

      if (c > 0) {
        ac.put(a, c);
      } else {
        ac.remove(a);
      }

      if (ac.containsKey(a & x)) {
        println(1);
        return;
      }

      ac.put(a, ac.getOrDefault(a, 0) + 1);
    }

    ac.clear();
    for (int a : aa) {
      a &= x;

      if (ac.containsKey(a)) {
        println(2);
        return;
      }

      ac.put(a, null);
    }

    println(-1);
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P1013B().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  void shuffle(int [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      int t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  void shuffle(long [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      long t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  void shuffle(Object [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      Object t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }
}