#include <bits/stdc++.h>
using namespace std;
const int nn = 5011;
const int mm = 1000011;
int n, k, m, te;
int a[nn], r[nn], c[nn], b[10], d[10];
int p[mm], q[nn * nn / 2], f[nn * nn / 2], g[nn * nn / 2];
void add(int x, int y, int z) {
  f[++te] = y;
  g[te] = z;
  q[te] = p[x];
  p[x] = te;
}
void init() {
  int i, j;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    m = max(m, a[i]);
  }
  sort(a + 1, a + n + 1);
  for (i = 2; i <= n; ++i)
    for (j = 1; j < i; ++j) add(a[i] - a[j], i, j);
}
void work() {
  int i, j, s, t, l;
  for (i = 1; i <= m + 1; ++i) {
    s = t = 0;
    for (j = 1; i * j <= m && s <= 8 && t <= 10; ++j)
      for (l = p[i * j]; l && s <= 8 && t <= 10; l = q[l]) {
        ++t;
        if (c[f[l]] != i) b[++s] = f[l], r[f[l]] = 0;
        if (c[g[l]] != i) b[++s] = g[l], r[g[l]] = 0;
        c[f[l]] = c[g[l]] = i;
        ++r[f[l]];
        ++r[g[l]];
      }
    if (s <= 8 && t <= 10) {
      memset(d, 0, sizeof(d));
      for (j = 1; j <= s; ++j) ++d[r[b[j]]];
      for (j = 1; j <= 4; ++j) s -= d[j] / (j + 1);
      if (s <= k) break;
    }
  }
  printf("%d\n", i);
}
int main() {
  init();
  work();
  return 0;
}

### Prompt

Please create a solution in Cpp 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 nn = 5011;
const int mm = 1000011;
int n, k, m, te;
int a[nn], r[nn], c[nn], b[10], d[10];
int p[mm], q[nn * nn / 2], f[nn * nn / 2], g[nn * nn / 2];
void add(int x, int y, int z) {
  f[++te] = y;
  g[te] = z;
  q[te] = p[x];
  p[x] = te;
}
void init() {
  int i, j;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    m = max(m, a[i]);
  }
  sort(a + 1, a + n + 1);
  for (i = 2; i <= n; ++i)
    for (j = 1; j < i; ++j) add(a[i] - a[j], i, j);
}
void work() {
  int i, j, s, t, l;
  for (i = 1; i <= m + 1; ++i) {
    s = t = 0;
    for (j = 1; i * j <= m && s <= 8 && t <= 10; ++j)
      for (l = p[i * j]; l && s <= 8 && t <= 10; l = q[l]) {
        ++t;
        if (c[f[l]] != i) b[++s] = f[l], r[f[l]] = 0;
        if (c[g[l]] != i) b[++s] = g[l], r[g[l]] = 0;
        c[f[l]] = c[g[l]] = i;
        ++r[f[l]];
        ++r[g[l]];
      }
    if (s <= 8 && t <= 10) {
      memset(d, 0, sizeof(d));
      for (j = 1; j <= s; ++j) ++d[r[b[j]]];
      for (j = 1; j <= 4; ++j) s -= d[j] / (j + 1);
      if (s <= k) break;
    }
  }
  printf("%d\n", i);
}
int main() {
  init();
  work();
  return 0;
}

```