There is an array with _n_ elements _a_1, _a_2, ..., _a__n_ and the number _x_.
In one operation you can select some _i_ (1 ≤ _i_ ≤ _n_) and replace element _a__i_ with _a__i_ & _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 _a__i_ = _a__j_. 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 _a__i_ (1 ≤ _a__i_ ≤ 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.
[samples]
## 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.
给定一个包含 #cf_span[n] 个元素的数组 #cf_span[a1, a2, ..., an] 和一个数 #cf_span[x]。
在一次操作中,你可以选择某个 #cf_span[i] (#cf_span[1 ≤ i ≤ n]),并将元素 #cf_span[ai] 替换为 #cf_span[ai & x],其中 #cf_span[&] 表示按位与运算。
你希望在应用若干次操作(可能为零次)后,数组中至少有两个相等的元素。换句话说,存在至少两个不同的下标 #cf_span[i ≠ j] 使得 #cf_span[ai = aj]。请判断是否可能达成目标,如果可能,求出所需的最少操作次数。
第一行包含两个整数 #cf_span[n] 和 #cf_span[x] (#cf_span[2 ≤ n ≤ 100 000], #cf_span[1 ≤ x ≤ 100 000]),分别表示数组元素个数和用于按位与的数。
第二行包含 #cf_span[n] 个整数 #cf_span[ai] (#cf_span[1 ≤ ai ≤ 100 000]),表示数组的元素。
请输出一个整数,表示所需的最少操作次数;如果不可能达成目标,请输出 _-1_。
在第一个例子中,可以对数组的最后一个元素应用操作,将 7 替换为 3,因此一步即可达成目标。
在第二个例子中,数组中已经存在两个相等的元素。
在第三个例子中,应用操作不会改变数组中的任何元素,因此无法使任意两个元素相等。
## Input
第一行包含两个整数 #cf_span[n] 和 #cf_span[x] (#cf_span[2 ≤ n ≤ 100 000], #cf_span[1 ≤ x ≤ 100 000]),分别表示数组元素个数和用于按位与的数。第二行包含 #cf_span[n] 个整数 #cf_span[ai] (#cf_span[1 ≤ ai ≤ 100 000]),表示数组的元素。
## Output
请输出一个整数,表示所需的最少操作次数;如果不可能达成目标,请输出 _-1_。
[samples]
## Note
在第一个例子中,可以对数组的最后一个元素应用操作,将 7 替换为 3,因此一步即可达成目标。在第二个例子中,数组中已经存在两个相等的元素。在第三个例子中,应用操作不会改变数组中的任何元素,因此无法使任意两个元素相等。
**Definitions**
Let $ n \in \mathbb{Z}^+ $, $ x \in \mathbb{Z}^+ $, and $ A = (a_1, a_2, \dots, a_n) $ where $ a_i \in \mathbb{Z}^+ $.
Define the operation: for any index $ i \in \{1, \dots, n\} $, replace $ a_i $ with $ a_i \& x $.
Let $ B = \{ a_i \& x \mid i \in \{1, \dots, n\} \} $ be the set of possible values after applying the operation to any subset of elements.
**Constraints**
1. $ 2 \leq n \leq 100{,}000 $
2. $ 1 \leq x \leq 100{,}000 $
3. $ 1 \leq a_i \leq 100{,}000 $ for all $ i $
**Objective**
Find the minimal number of operations (i.e., minimal number of elements to replace with $ a_i \& x $) such that the resulting array contains at least two equal elements.
If impossible, return $-1$.
**Approach**
Let:
- $ S = \{ a_i \mid i \in \{1, \dots, n\} \} $ (original values)
- $ T = \{ a_i \& x \mid i \in \{1, \dots, n\} \} $ (values after operation)
We consider three cases:
1. **Already has duplicate**: if $ |S| < n $, then 0 operations needed.
2. **Can create duplicate via operation**:
- If there exist $ i \ne j $ such that $ a_i \& x = a_j \& x $ and $ a_i \ne a_j $, then 1 operation suffices (change one of them).
- If there exists $ i $ such that $ a_i \& x = a_j $ for some $ j \ne i $, then 1 operation suffices (change $ a_i $ to match $ a_j $).
3. **Impossible**: if no two elements can become equal after any number of operations (i.e., all $ a_i $ are distinct, and all $ a_i \& x $ are distinct and not equal to any original $ a_j $).
Thus, minimal operations:
- 0, if duplicate exists in $ A $
- 1, if $ \exists i \ne j $ such that $ (a_i \& x = a_j \& x) $ and $ a_i \ne a_j $, OR $ a_i \& x = a_j $ for some $ j \ne i $
- 2, if $ \exists i \ne j $ such that $ a_i \& x = a_j \& x $ and $ a_i \ne a_j $, and no 1-operation solution exists (i.e., both must be changed to match)
- -1, otherwise
**Formal Objective**
Compute:
$$
\min \left\{ k \in \{0, 1, 2\} \,\middle|\, \exists \, I \subseteq \{1,\dots,n\},\, |I| = k,\, \text{such that } \left| \left\{ b_i = \begin{cases} a_i \& x & i \in I \\ a_i & i \notin I \end{cases} \right\} \right| < n \right\}
$$
If no such $ k \leq 2 $ exists, return $-1$.