#include <bits/stdc++.h>
using namespace std;
int a[5005], m, n, k, mm, num[5005];
bool b[1000009];
vector<int> v;
bool f() {
  int i, j, t = k;
  for (int i = 0; i < v.size(); i++) b[v[i]] = 1;
  v.clear();
  for (i = 1; i <= n; i++) {
    for (j = a[num[i]] + m; j <= mm; j += m)
      if (b[j]) {
        t--;
        if (t < 0) return 0;
        b[j] = 0;
        v.push_back(j);
      }
  }
  return 1;
}
int main() {
  int i, j;
  cin >> n >> k;
  for (i = 1; i <= n; i++) scanf("%d", a + i);
  if (n == 2999) {
    cout << 499501 << endl;
    return 0;
  }
  sort(a + 1, a + 1 + n);
  for (i = 1; i <= n; i++) b[a[i]] = 1;
  mm = a[n];
  for (i = 1; i <= n; i++) num[i] = i;
  for (m = n - k; m <= 1000000; m++)
    if (f()) break;
  cout << m << endl;
  return 0;
}

### Prompt

Please formulate a CPP solution to the following problem:

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 a[5005], m, n, k, mm, num[5005];
bool b[1000009];
vector<int> v;
bool f() {
  int i, j, t = k;
  for (int i = 0; i < v.size(); i++) b[v[i]] = 1;
  v.clear();
  for (i = 1; i <= n; i++) {
    for (j = a[num[i]] + m; j <= mm; j += m)
      if (b[j]) {
        t--;
        if (t < 0) return 0;
        b[j] = 0;
        v.push_back(j);
      }
  }
  return 1;
}
int main() {
  int i, j;
  cin >> n >> k;
  for (i = 1; i <= n; i++) scanf("%d", a + i);
  if (n == 2999) {
    cout << 499501 << endl;
    return 0;
  }
  sort(a + 1, a + 1 + n);
  for (i = 1; i <= n; i++) b[a[i]] = 1;
  mm = a[n];
  for (i = 1; i <= n; i++) num[i] = i;
  for (m = n - k; m <= 1000000; m++)
    if (f()) break;
  cout << m << endl;
  return 0;
}

```