#include <bits/stdc++.h>
using namespace std;
const int S = 11;
vector<pair<short, short> > dif[1000010];
int sz[1000010];
int a[5010];
int bad[5010];
int b[1000010];
int main() {
  srand(time(NULL));
  int n, k;
  int max1 = -1;
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); ++i) {
    scanf("%d", &a[i]);
    max1 = ((max1 < a[i]) ? (a[i]) : (max1));
  }
  sort(a, a + n);
  for (int i = (0); i < (n); ++i)
    for (int j = (i + 1); j < (n); ++j) {
      int c = a[j] - a[i];
      if (dif[c].size() < S) dif[c].push_back(make_pair(i, j));
    }
  int res = -1;
  int st = 1;
  st = ((st < n - k) ? (n - k) : (st));
  for (int i = max1 + 1; i >= st; --i) {
    int cnt = 0;
    bool f = true;
    for (int j = i; j <= max1; j += i)
      if (b[j]) {
        f = false;
        break;
      }
    if (!f) {
      b[i] = 1;
      continue;
    }
    for (int j = i; j <= max1; j += i) {
      if (cnt > k) break;
      for (int c = (0); c < (dif[j].size()); ++c) {
        int c1 = dif[j][c].first;
        int c2 = dif[j][c].second;
        if (bad[c1] == i) continue;
        if (bad[c2] == i) continue;
        cnt++;
        bad[c2] = i;
        if (cnt > k) break;
      }
    }
    if (cnt <= k) {
      res = i;
    } else {
      b[i] = 1;
    }
  }
  cout << res << endl;
  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 S = 11;
vector<pair<short, short> > dif[1000010];
int sz[1000010];
int a[5010];
int bad[5010];
int b[1000010];
int main() {
  srand(time(NULL));
  int n, k;
  int max1 = -1;
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); ++i) {
    scanf("%d", &a[i]);
    max1 = ((max1 < a[i]) ? (a[i]) : (max1));
  }
  sort(a, a + n);
  for (int i = (0); i < (n); ++i)
    for (int j = (i + 1); j < (n); ++j) {
      int c = a[j] - a[i];
      if (dif[c].size() < S) dif[c].push_back(make_pair(i, j));
    }
  int res = -1;
  int st = 1;
  st = ((st < n - k) ? (n - k) : (st));
  for (int i = max1 + 1; i >= st; --i) {
    int cnt = 0;
    bool f = true;
    for (int j = i; j <= max1; j += i)
      if (b[j]) {
        f = false;
        break;
      }
    if (!f) {
      b[i] = 1;
      continue;
    }
    for (int j = i; j <= max1; j += i) {
      if (cnt > k) break;
      for (int c = (0); c < (dif[j].size()); ++c) {
        int c1 = dif[j][c].first;
        int c2 = dif[j][c].second;
        if (bad[c1] == i) continue;
        if (bad[c2] == i) continue;
        cnt++;
        bad[c2] = i;
        if (cnt > k) break;
      }
    }
    if (cnt <= k) {
      res = i;
    } else {
      b[i] = 1;
    }
  }
  cout << res << endl;
  return 0;
}

```