#P6824. 「EZEC-4」可乐

「EZEC-4」可乐

Background

A long time ago, there was a pigstd who was very obsessed with delicious cola. In order to get tasty cola, he almost spent all his money. He did not even care about his npy (actually because he had no npy), and he also did not like watching shows. Only after buying new cola would he take a carriage out to show off. Every day, every hour, he had to drink a bottle of new cola.

Recently, pigstd bought many more cases of new cola—of course, only smart people can drink these colas.

Problem Description

pigstd now has nn cases of cola. The ii-th case is labeled with a positive integer aia_i.

If pigstd's smartness value is a non-negative integer xx, then for the ii-th case of cola, if (aix)k(a_i \oplus x) \le k, pigstd can drink this case of cola.

Now pigstd tells you kk and the sequence aa. You may choose pigstd's smartness value xx so that the number of cola cases he can drink is maximized. Find this maximum value.

Input Format

The first line contains two integers nn and kk, separated by spaces.

The next nn lines each contain one integer aia_i, indicating the number labeled on the ii-th case of cola.

Output Format

Output one positive integer in a single line, indicating the maximum number of cola cases that pigstd can drink.

3 5
2
3
4
3
4 625
879
480
671
853

4

Hint

Hint

pigstd's smartness value xx can be 00.

Sample Explanation

Sample 1: It is easy to construct that when x=0x = 0, he can drink all colas.

Sample 2: It is easy to construct x=913x = 913, and he can drink all colas.

The sample explanation is not necessarily the only way.

Constraints

This problem uses bundled testdata.

  • Subtask 1 (29 points): 1n,k,ai10001 \le n, k, a_i \le 1000.

  • Subtask 2 (1 points): aika_i \le k.

  • Subtask 3 (70 points): No special restrictions.

For all data, it is guaranteed that 1n,k,ai1061 \le n, k, a_i \le 10^6.

\oplus denotes XOR. If you do not know what XOR is, please click here.

Translated by ChatGPT 5