#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 5;
const int maxm = 1000000 + 5;
int a[maxn];
int b[maxm];
bool vis[maxm];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  for (int i = 2; i <= n; i++)
    for (int j = 1; j < i; j++) b[a[i] - a[j]]++;
  int ans, tmp = (k + 1) * k / 2;
  for (int i = n - k;; i++) {
    int num = 0;
    for (int j = i; j <= a[n]; j += i) num += b[j];
    if (num > tmp) continue;
    num = 0;
    memset(vis, false, sizeof(vis));
    for (int j = 1; j <= n; j++) {
      int d = a[j] % i;
      if (vis[d])
        num++;
      else
        vis[d] = true;
    }
    if (num <= k) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans);
  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 = 5000 + 5;
const int maxm = 1000000 + 5;
int a[maxn];
int b[maxm];
bool vis[maxm];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  for (int i = 2; i <= n; i++)
    for (int j = 1; j < i; j++) b[a[i] - a[j]]++;
  int ans, tmp = (k + 1) * k / 2;
  for (int i = n - k;; i++) {
    int num = 0;
    for (int j = i; j <= a[n]; j += i) num += b[j];
    if (num > tmp) continue;
    num = 0;
    memset(vis, false, sizeof(vis));
    for (int j = 1; j <= n; j++) {
      int d = a[j] % i;
      if (vis[d])
        num++;
      else
        vis[d] = true;
    }
    if (num <= k) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}

```