F. Kozak Vus and the Candies#8756

F. Kozak Vus and the Candies

1 second
64 megabytes
Easy

Cossack Vus loves jumping and has a sweet tooth for candies. One day, he found himself on a number line where candies were placed at certain integer points, with at most one candy per point. Overjoyed, Vus decided to collect as many candies as he could. To achieve this, he can select any integer x > 1 and an initial position (where is an integer). He will then visit every point of the form s + kx, where is a non-negative integer. Whenever Vus lands on a point with a candy, he picks it up (even though perhaps he shouldn't!). Your task is to help Vus collect the maximum number of candies possible.

Input

The first line contains two integers and (1 \leq n \leq 10^5;~0 \leq g \leq 6) — the number of candies and the block number, respectively.

The second line contains integers a_1, a_2, \dotsc, a_n (1 \leq a_i \leq 10^9) — the positions where the candies are located. It is guaranteed that all a_i are distinct.

Interaction

You need to implement the following function:

integer solve(integer n, integer g, array of integers m)

  • — the number of candies;

  • — block number;

  • — array of candy positions;

  • The function should return a single integer — the maximum number of candies Vus can collect.

Output

Output a single integer — the maximum number of candies Vus can collect.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Note

In the first example, Vus can choose x = 2 and collect candies at positions , , and .

In the second example, Vus can choose x = 3 and collect candies at positions , , , , and .

Scoring

  1. (4 points) n \leq 2, a_i \leq 10;

  2. (5 points) n \leq 3, a_i \leq 10^2;

  3. (12 points) n \leq 10, a_i \leq 10^2;

  4. (20 points) n \leq 10^3, a_i \leq 10^4;

  5. (25 points) n \leq 10^4, a_i \leq 10^6;

  6. (34 points) no additional constraints.