#include <bits/stdc++.h>
using namespace std;
const int sz = 1e6 + 10;
int a[5010];
vector<int> v[sz];
bool vis[sz];
bool vis2[sz];
vector<int> cl;
int abs(int x) {
  if (x < 0) return -x;
  return x;
}
int main() {
  int n, k, maxn = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    maxn = max(maxn, a[i]);
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      int tmp = abs(a[i] - a[j]);
      if (v[tmp].size() > 2 * k + 1) continue;
      v[tmp].push_back(a[i]);
      v[tmp].push_back(a[j]);
    }
  memset(vis, 0, sizeof(vis));
  memset(vis2, 0, sizeof(vis2));
  cl.clear();
  for (int i = 1; i <= maxn + 1; i++) {
    int cnt = 0;
    bool flag = true;
    for (int j = 1; j <= maxn / i; j++) {
      if (v[i * j].size() >= 2 * (k + 1)) {
        flag = false;
        break;
      }
      for (int kk = 0; kk < v[i * j].size(); kk++) {
        if (vis[v[i * j][kk]]) continue;
        if (vis2[v[i * j][kk] % i])
          cnt++;
        else
          vis2[v[i * j][kk] % i] = true;
        vis[v[i * j][kk]] = true;
        cl.push_back(v[i * j][kk]);
        if (cnt > k) break;
      }
      if (cnt > k) {
        flag = false;
        break;
      }
    }
    if (flag) {
      printf("%d\n", i);
      return 0;
    }
    for (int j = 0; j < cl.size(); j++) {
      vis[cl[j]] = false;
      vis2[cl[j] % i] = false;
    }
    cl.clear();
  }
  return 0;
}

### Prompt

Generate 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 sz = 1e6 + 10;
int a[5010];
vector<int> v[sz];
bool vis[sz];
bool vis2[sz];
vector<int> cl;
int abs(int x) {
  if (x < 0) return -x;
  return x;
}
int main() {
  int n, k, maxn = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    maxn = max(maxn, a[i]);
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      int tmp = abs(a[i] - a[j]);
      if (v[tmp].size() > 2 * k + 1) continue;
      v[tmp].push_back(a[i]);
      v[tmp].push_back(a[j]);
    }
  memset(vis, 0, sizeof(vis));
  memset(vis2, 0, sizeof(vis2));
  cl.clear();
  for (int i = 1; i <= maxn + 1; i++) {
    int cnt = 0;
    bool flag = true;
    for (int j = 1; j <= maxn / i; j++) {
      if (v[i * j].size() >= 2 * (k + 1)) {
        flag = false;
        break;
      }
      for (int kk = 0; kk < v[i * j].size(); kk++) {
        if (vis[v[i * j][kk]]) continue;
        if (vis2[v[i * j][kk] % i])
          cnt++;
        else
          vis2[v[i * j][kk] % i] = true;
        vis[v[i * j][kk]] = true;
        cl.push_back(v[i * j][kk]);
        if (cnt > k) break;
      }
      if (cnt > k) {
        flag = false;
        break;
      }
    }
    if (flag) {
      printf("%d\n", i);
      return 0;
    }
    for (int j = 0; j < cl.size(); j++) {
      vis[cl[j]] = false;
      vis2[cl[j] % i] = false;
    }
    cl.clear();
  }
  return 0;
}

```