#include <bits/stdc++.h>
using namespace std;
int f[1000005], a[5005];
int v[1000005];
int n, K;
bool check(int x) {
  for (int i = 0; i < x; i++) v[i] = 0;
  int t, ret = 0;
  for (int i = 1; i <= n; i++) {
    t = a[i] % x;
    v[t]++;
    if (v[t] > 1) ret++;
  }
  return ret <= K;
}
int main() {
  while (scanf("%d %d", &n, &K) != EOF) {
    int Max = -1;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      Max = max(Max, a[i]);
    }
    for (int i = 0; i < Max; i++) f[i] = 0;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++)
        f[a[i] > a[j] ? a[i] - a[j] : a[j] - a[i]]++;
    int flag = K * (K + 1) / 2, t, ans;
    for (int i = max(1, n - K); i <= Max; i++) {
      t = 0;
      for (int j = i; j <= Max; j += i) {
        t += f[j];
        if (t > flag) break;
      }
      if (t <= flag && check(i)) {
        ans = i;
        break;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

### Prompt

Create a solution in cpp for 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 f[1000005], a[5005];
int v[1000005];
int n, K;
bool check(int x) {
  for (int i = 0; i < x; i++) v[i] = 0;
  int t, ret = 0;
  for (int i = 1; i <= n; i++) {
    t = a[i] % x;
    v[t]++;
    if (v[t] > 1) ret++;
  }
  return ret <= K;
}
int main() {
  while (scanf("%d %d", &n, &K) != EOF) {
    int Max = -1;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      Max = max(Max, a[i]);
    }
    for (int i = 0; i < Max; i++) f[i] = 0;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++)
        f[a[i] > a[j] ? a[i] - a[j] : a[j] - a[i]]++;
    int flag = K * (K + 1) / 2, t, ans;
    for (int i = max(1, n - K); i <= Max; i++) {
      t = 0;
      for (int j = i; j <= Max; j += i) {
        t += f[j];
        if (t > flag) break;
      }
      if (t <= flag && check(i)) {
        ans = i;
        break;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

```