#include <bits/stdc++.h>
using namespace std;
bool debug = false;
int n, m, k;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long ln, lk, lm;
const int L = 1000005;
int v[L];
int a[1000005], S, cnt[1000005];
void ck() {
  int bad = 0, ss = 0;
  for (int i = m; i < L; i += m) {
    if (bad + v[i] > S) return;
    bad += v[i];
  }
  bool vd = 0;
  int i = 0;
  for (; i < n; i++) {
    int tar = a[i] % m;
    if (cnt[tar] != 0) ss++;
    if (ss > k) {
      vd = 1;
      break;
    }
    cnt[tar]++;
  }
  for (int j = 0; j <= i; j++) {
    cnt[a[j] % m] = 0;
  }
  if (!vd) {
    printf("%d\n", m);
    exit(0);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    scanf("%d", a + i);
  }
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    for (int j = i + 1; j < n; j++) {
      v[abs(a[i] - a[j])]++;
    }
  }
  S = k * (k + 1) / 2;
  for (m = 1; m < L; m++) ck();
  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;
bool debug = false;
int n, m, k;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long ln, lk, lm;
const int L = 1000005;
int v[L];
int a[1000005], S, cnt[1000005];
void ck() {
  int bad = 0, ss = 0;
  for (int i = m; i < L; i += m) {
    if (bad + v[i] > S) return;
    bad += v[i];
  }
  bool vd = 0;
  int i = 0;
  for (; i < n; i++) {
    int tar = a[i] % m;
    if (cnt[tar] != 0) ss++;
    if (ss > k) {
      vd = 1;
      break;
    }
    cnt[tar]++;
  }
  for (int j = 0; j <= i; j++) {
    cnt[a[j] % m] = 0;
  }
  if (!vd) {
    printf("%d\n", m);
    exit(0);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    scanf("%d", a + i);
  }
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    for (int j = i + 1; j < n; j++) {
      v[abs(a[i] - a[j])]++;
    }
  }
  S = k * (k + 1) / 2;
  for (m = 1; m < L; m++) ck();
  return 0;
}

```