#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005, MAXC = 1000005;
int a[MAXN], b[MAXC], c[MAXC];
int n, k, _max;
int main() {
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  };
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), _max = max(_max, a[i]);
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) b[abs(a[i] - a[j])]++;
  for (int res = n - k; res <= 1000001; res++) {
    int cnt = 0;
    bool ok = true;
    for (int i = res; i <= _max; i += res) {
      cnt += b[i];
      if (cnt > (k + 1) * k / 2) {
        ok = false;
        break;
      }
    }
    if (!ok) continue;
    int x = 0;
    for (int i = 1; i <= n; i++) {
      if (c[a[i] % res]) x++;
      c[a[i] % res]++;
    }
    if (x <= k) {
      cout << res << endl;
      return 0;
    }
    for (int i = 1; i <= n; i++) c[a[i] % res] = 0;
  }
  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;
const int MAXN = 5005, MAXC = 1000005;
int a[MAXN], b[MAXC], c[MAXC];
int n, k, _max;
int main() {
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  };
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), _max = max(_max, a[i]);
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) b[abs(a[i] - a[j])]++;
  for (int res = n - k; res <= 1000001; res++) {
    int cnt = 0;
    bool ok = true;
    for (int i = res; i <= _max; i += res) {
      cnt += b[i];
      if (cnt > (k + 1) * k / 2) {
        ok = false;
        break;
      }
    }
    if (!ok) continue;
    int x = 0;
    for (int i = 1; i <= n; i++) {
      if (c[a[i] % res]) x++;
      c[a[i] % res]++;
    }
    if (x <= k) {
      cout << res << endl;
      return 0;
    }
    for (int i = 1; i <= n; i++) c[a[i] % res] = 0;
  }
  return 0;
}

```