#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
int sa[maxn], d[maxn];
bool vis[maxn];
int n, k;
bool check(int mod) {
  memset(vis, false, sizeof(vis));
  int c = 0;
  for (int i = 0; i < n; i++) {
    int t = sa[i] % mod;
    if (vis[t]) c++;
    vis[t] = true;
  }
  if (c <= k)
    return true;
  else
    return false;
}
int main() {
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 0; i < n; i++) scanf("%d", &sa[i]);
    sort(sa, sa + n);
    memset(d, 0, sizeof(d));
    for (int i = 1; i < n; i++) {
      for (int j = 0; j < i; j++) d[sa[i] - sa[j]]++;
    }
    int m = sa[n - 1] + 1;
    int ans = 1;
    for (; ans <= m; ans++) {
      int c = 0;
      for (int j = ans; j <= m; j += ans) c += d[j];
      if (c <= k * (k + 1) / 2 && check(ans)) break;
    }
    printf("%d\n", ans);
  }
  return 0;
}

### Prompt

Your task is to create 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;
const int maxn = 1000010;
int sa[maxn], d[maxn];
bool vis[maxn];
int n, k;
bool check(int mod) {
  memset(vis, false, sizeof(vis));
  int c = 0;
  for (int i = 0; i < n; i++) {
    int t = sa[i] % mod;
    if (vis[t]) c++;
    vis[t] = true;
  }
  if (c <= k)
    return true;
  else
    return false;
}
int main() {
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 0; i < n; i++) scanf("%d", &sa[i]);
    sort(sa, sa + n);
    memset(d, 0, sizeof(d));
    for (int i = 1; i < n; i++) {
      for (int j = 0; j < i; j++) d[sa[i] - sa[j]]++;
    }
    int m = sa[n - 1] + 1;
    int ans = 1;
    for (; ans <= m; ans++) {
      int c = 0;
      for (int j = ans; j <= m; j += ans) c += d[j];
      if (c <= k * (k + 1) / 2 && check(ans)) break;
    }
    printf("%d\n", ans);
  }
  return 0;
}

```