#include <bits/stdc++.h>
using namespace std;
int a[5000], vis[1000001], f[1000001];
int mod(int a) { return a > 0 ? a : -a; }
int main() {
  int n, k, i, j, v, m = 0, penal;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  memset(f, 0, sizeof(f));
  for (i = 0; i < n; i++)
    for (j = i + 1; j < n; j++) {
      v = mod(a[i] - a[j]);
      for (int k = 1; k <= 5; k++)
        if (v % k == 0) f[v / k]++;
    }
  for (m = 1;; m++) {
    if (f[m] > k * (k + 1) / 2) continue;
    penal = 0;
    for (i = 0; i < m; i++) vis[i] = 0;
    for (i = 0; i < n; i++) {
      v = a[i] % m;
      if (!vis[v])
        vis[v] = 1;
      else {
        penal++;
        if (penal > k) break;
      }
    }
    if (penal <= k) break;
  }
  cout << m << endl;
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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;
int a[5000], vis[1000001], f[1000001];
int mod(int a) { return a > 0 ? a : -a; }
int main() {
  int n, k, i, j, v, m = 0, penal;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  memset(f, 0, sizeof(f));
  for (i = 0; i < n; i++)
    for (j = i + 1; j < n; j++) {
      v = mod(a[i] - a[j]);
      for (int k = 1; k <= 5; k++)
        if (v % k == 0) f[v / k]++;
    }
  for (m = 1;; m++) {
    if (f[m] > k * (k + 1) / 2) continue;
    penal = 0;
    for (i = 0; i < m; i++) vis[i] = 0;
    for (i = 0; i < n; i++) {
      v = a[i] % m;
      if (!vis[v])
        vis[v] = 1;
      else {
        penal++;
        if (penal > k) break;
      }
    }
    if (penal <= k) break;
  }
  cout << m << endl;
  return 0;
}

```