#include <bits/stdc++.h>
using namespace std;
int f[6000], a[6000], cnt[1100000], CNT[1100000];
int tot, TOT, n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) ++cnt[abs(a[i] - a[j])];
  for (int i = n - k;; ++i) {
    tot = 0;
    for (int j = i; j <= 1000000; j += i) tot += cnt[j];
    if (tot <= k * (k + 1) / 2) {
      TOT = 0;
      for (int j = 1; j <= n; ++j)
        if (CNT[a[j] % i])
          ++TOT;
        else
          CNT[a[j] % i] = 1, f[++f[0]] = a[j] % i;
      for (int j = 1; j <= f[0]; ++j) CNT[f[j]] = 0;
      f[0] = 0;
      if (TOT <= k) {
        printf("%d\n", i);
        return 0;
      }
    }
  }
}

### Prompt

Please provide a CPP coded solution to the problem described below:

You have been given n distinct integers a1, a2, ..., an. You can remove at most k of them. Find the minimum modular m (m > 0), so that for every pair of the remaining integers (ai, aj), the following unequality holds: <image>.

Input

The first line contains two integers n and k (1 ≤ n ≤ 5000, 0 ≤ k ≤ 4), which we have mentioned above. 

The second line contains n distinct integers a1, a2, ..., an (0 ≤ ai ≤ 106).

Output

Print a single positive integer — the minimum m.

Examples

Input

7 0
0 2 3 6 7 12 18


Output

13


Input

7 1
0 2 3 6 7 12 18


Output

7

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int f[6000], a[6000], cnt[1100000], CNT[1100000];
int tot, TOT, n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) ++cnt[abs(a[i] - a[j])];
  for (int i = n - k;; ++i) {
    tot = 0;
    for (int j = i; j <= 1000000; j += i) tot += cnt[j];
    if (tot <= k * (k + 1) / 2) {
      TOT = 0;
      for (int j = 1; j <= n; ++j)
        if (CNT[a[j] % i])
          ++TOT;
        else
          CNT[a[j] % i] = 1, f[++f[0]] = a[j] % i;
      for (int j = 1; j <= f[0]; ++j) CNT[f[j]] = 0;
      f[0] = 0;
      if (TOT <= k) {
        printf("%d\n", i);
        return 0;
      }
    }
  }
}

```