#include <bits/stdc++.h>
using namespace std;
int cnt[1000010], n, K, a[5010];
bool v[1000010];
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  for (int i = 1; i < n; i++)
    for (int j = 0; j < i; j++) cnt[a[i] - a[j]]++;
  int tot = K * (K + 1) >> 1;
  for (int m = 1; m <= a[n - 1] + 1; m++) {
    int tmp = 0;
    for (int i = m; i <= 1000000 && (tmp += cnt[i]) <= tot; i += m)
      ;
    if (tmp > tot) continue;
    tmp = 0;
    memset(v, 0, sizeof(v));
    for (int i = 0; i < n && tmp <= K; i++) {
      if (v[a[i] % m])
        tmp++;
      else
        v[a[i] % m] = 1;
    }
    if (tmp <= K) {
      printf("%d\n", m);
      break;
    }
  }
  return 0;
}

### Prompt

Develop a solution in cpp 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 cnt[1000010], n, K, a[5010];
bool v[1000010];
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  for (int i = 1; i < n; i++)
    for (int j = 0; j < i; j++) cnt[a[i] - a[j]]++;
  int tot = K * (K + 1) >> 1;
  for (int m = 1; m <= a[n - 1] + 1; m++) {
    int tmp = 0;
    for (int i = m; i <= 1000000 && (tmp += cnt[i]) <= tot; i += m)
      ;
    if (tmp > tot) continue;
    tmp = 0;
    memset(v, 0, sizeof(v));
    for (int i = 0; i < n && tmp <= K; i++) {
      if (v[a[i] % m])
        tmp++;
      else
        v[a[i] % m] = 1;
    }
    if (tmp <= K) {
      printf("%d\n", m);
      break;
    }
  }
  return 0;
}

```