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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.TreeMap;
import java.util.TreeSet;
					public class Main implements Runnable
					{
						static final long MOD = 1000000007L;
						static final long MOD2 = 1000000009L;
						static class InputReader
						{
							private InputStream stream;
							private byte[] buf = new byte[1024];
							private int curChar;
							private int numChars;
							private SpaceCharFilter filter;
							private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
					 
							public InputReader(InputStream stream)
							{
								this.stream = stream;
							}
							
							public int read()
							{
								if (numChars==-1) 
									throw new InputMismatchException();
								
								if (curChar >= numChars)
								{
									curChar = 0;
									try 
									{
										numChars = stream.read(buf);
									}
									catch (IOException e)
									{
										throw new InputMismatchException();
									}
									
									if(numChars <= 0)				
										return -1;
								}
								return buf[curChar++];
							}
						 
							public String nextLine()
							{
								String str = "";
					            try
					            {
					                str = br.readLine();
					            }
					            catch (IOException e)
					            {
					                e.printStackTrace();
					            }
					            return str;
							}
							public int nextInt()
							{
								int c = read();
								
								while(isSpaceChar(c)) 
									c = read();
								
								int sgn = 1;
								
								if (c == '-') 
								{
									sgn = -1;
									c = read();
								}
								
								int res = 0;
								do 
								{
									if(c<'0'||c>'9') 
										throw new InputMismatchException();
									res *= 10;
									res += c - '0';
									c = read();
								}
								while (!isSpaceChar(c)); 
								
								return res * sgn;
							}
							
							public long nextLong() 
							{
								int c = read();
								while (isSpaceChar(c))
									c = read();
								int sgn = 1;
								if (c == '-') 
								{
									sgn = -1;
									c = read();
								}
								long res = 0;
								
								do 
								{
									if (c < '0' || c > '9')
										throw new InputMismatchException();
									res *= 10;
									res += c - '0';
									c = read();
								}
								while (!isSpaceChar(c));
									return res * sgn;
							}
							
							public double nextDouble() 
							{
								int c = read();
								while (isSpaceChar(c))
									c = read();
								int sgn = 1;
								if (c == '-') 
								{
									sgn = -1;
									c = read();
								}
								double res = 0;
								while (!isSpaceChar(c) && c != '.') 
								{
									if (c == 'e' || c == 'E')
										return res * Math.pow(10, nextInt());
									if (c < '0' || c > '9')
										throw new InputMismatchException();
									res *= 10;
									res += c - '0';
									c = read();
								}
								if (c == '.') 
								{
									c = read();
									double m = 1;
									while (!isSpaceChar(c)) 
									{
										if (c == 'e' || c == 'E')
											return res * Math.pow(10, nextInt());
										if (c < '0' || c > '9')
											throw new InputMismatchException();
										m /= 10;
										res += (c - '0') * m;
										c = read();
									}
								}
								return res * sgn;
							}
							
							public String readString() 
							{
								int c = read();
								while (isSpaceChar(c))
									c = read();
								StringBuilder res = new StringBuilder();
								do 
								{
									res.appendCodePoint(c);
									c = read();
								} 
								while (!isSpaceChar(c));
								
								return res.toString();
							}
						 
							public boolean isSpaceChar(int c) 
							{
								if (filter != null)
									return filter.isSpaceChar(c);
								return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
							}
						 
							public String next() 
							{
								return readString();
							}
							
							public interface SpaceCharFilter 
							{
								public boolean isSpaceChar(int ch);
							}
						}
					 	
						public static void main(String args[]) throws Exception
						{
							new Thread(null, new Main(),"Main",1<<26).start();
						}
						int MAXN = 1000001;
						HashMap<Integer,HashMap<Integer,Integer>> adj;
						ArrayList<Integer> adj2[];
						Integer[] arr;
						public void run() 
						{
							InputReader sc= new InputReader(System.in);
							PrintWriter w= new PrintWriter(System.out);
							int n = sc.nextInt();
							int x = sc.nextInt();
							int[] arr=  new int[n];
							TreeSet<Integer> tset = new TreeSet();
							for(int i = 0;i < n;i++) {
								arr[i] = sc.nextInt();
								tset.add(arr[i]);
							}
							if(tset.size() < n) {
								w.println("0");
								w.close();
								System.exit(0);
							}
							int[] temp = new int[n];
							for(int i = 0;i < n;i++) {
								temp[i] = arr[i] & x;
								if(temp[i] == arr[i]) {
									continue;
								}
								if(tset.contains(temp[i])) {
									w.println("1");
									w.close();
									System.exit(0);
								}
							}
							tset = new TreeSet();
							for(int i = 0;i < n;i++) {
								tset.add(temp[i]);
							}
							if(tset.size() < n) {
								w.println("2");
								w.close();
								System.exit(0);
							}
							w.println("-1");
							w.close();
						}
						
						boolean[] prime;
						void sieve() {
							prime = new boolean[MAXN];
							Arrays.fill(prime, true);
							prime[1] = false;
							for(int i = 2;i < MAXN;i++) {
								if(prime[i]) {
									for(int j = 2*i;j < MAXN;j += i) {
										prime[j] = false;
									}
								}
							}
						}
						long power(long a,long b,long mod) {
							long res = 1;
							a = a % mod;
							while(b > 0) {
								if(b % 2 == 1) {
									res = (res * a) % mod;
								}
								a = (a * a) % mod;
								b = b/2;
							}
							return res;
						}
						static class Pair{
							int a;
							int b;
							Pair(int a,int b){
								this.a = a;
								this.b = b;
							}
						}
						static class HopCroft{
							private final int NIL = 0;
							private final int INF = Integer.MAX_VALUE;
							private ArrayList<Integer>[] Adj; 
							private int[] Pair;
							private int[] Dist;
							private int cx, cy;
							
							public boolean BFS() {
								Queue<Integer> q = new LinkedList();
								for(int v = 1;v <= cx;v++) {
									if(Pair[v] == NIL) {
										Dist[v] = 0;
										q.add(v);
									}else {
										Dist[v] = INF;
									}
								}
								Dist[NIL] = INF;
								while(!q.isEmpty()) {
									int v = q.poll();
									if(Dist[v] < Dist[NIL]) {
										for(int u: Adj[v]) {
											if(Dist[Pair[u]] == INF) {
												Dist[Pair[u]] = Dist[v] + 1;
												q.add(Pair[u]);
											}
										}
									}
								}
								return Dist[NIL] != INF;
							}
							public boolean DFS(int v) {
								if(v != NIL) {
									for(int u: Adj[v]) {
										if(Dist[Pair[u]] == Dist[v] + 1) {
											if(DFS(Pair[u])) {
												Pair[u] = v;
												Pair[v] = u;
												return true;
											}
										}
									}
									Dist[v] = INF;
									return false;
								}
								return true;
							}
							public int HopcroftKarp() {
								Pair = new int[cx + cy + 1];
								Dist = new int[cx + cy + 1];
								int matching = 0;
								while(BFS()) {
									for(int v = 1;v <= cx;v++) {
										if(Pair[v] == NIL && DFS(v)) {
											matching++;
										}
									}
								}
								return matching;
							}
							public void makeGraph(int[] x,int[]
									y,int E) {
								  Adj = new ArrayList[cx + cy + 1];
							      for (int i = 0; i < Adj.length; ++i)
							            Adj[i] = new ArrayList<Integer>();        
							      for (int i = 0; i < E; ++i) 
							            addEdge(x[i] + 1, y[i] + 1);   
							}
							public void addEdge(int u,int v) {
								Adj[u].add(cx + v);
								Adj[cx + v].add(u);
							}
						}
					}