#include <bits/stdc++.h>
using namespace std;
int f[1000001];
int sum[1000001];
int main() {
  int n, k;
  while (cin >> n >> k) {
    int c[5001];
    int d[5001];
    for (int i = 0; i < n; i++) scanf("%d", &c[i]);
    for (int i = 0; i < n; i++)
      for (int j = i + 1; j < n; j++) sum[abs(c[i] - c[j])]++;
    for (int i = 1; i <= 1000000; i++)
      for (int j = 2 * i; j <= 1000000; j += i) sum[i] += sum[j];
    int dev = -1;
    memset(f, 0, sizeof(f));
    for (dev = 1;; dev++) {
      if (sum[dev] > k * (k + 1) / 2) continue;
      for (int i = 0; i < n; i++) f[c[i] % dev]++;
      int cont = 0;
      for (int i = 0; i < n; i++) {
        if (f[c[i] % dev] > 0) {
          cont++;
          f[c[i] % dev] = 0;
        }
      }
      cont = n - cont;
      if (cont <= k) break;
    }
    cout << dev << endl;
  }
  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;
int f[1000001];
int sum[1000001];
int main() {
  int n, k;
  while (cin >> n >> k) {
    int c[5001];
    int d[5001];
    for (int i = 0; i < n; i++) scanf("%d", &c[i]);
    for (int i = 0; i < n; i++)
      for (int j = i + 1; j < n; j++) sum[abs(c[i] - c[j])]++;
    for (int i = 1; i <= 1000000; i++)
      for (int j = 2 * i; j <= 1000000; j += i) sum[i] += sum[j];
    int dev = -1;
    memset(f, 0, sizeof(f));
    for (dev = 1;; dev++) {
      if (sum[dev] > k * (k + 1) / 2) continue;
      for (int i = 0; i < n; i++) f[c[i] % dev]++;
      int cont = 0;
      for (int i = 0; i < n; i++) {
        if (f[c[i] % dev] > 0) {
          cont++;
          f[c[i] % dev] = 0;
        }
      }
      cont = n - cont;
      if (cont <= k) break;
    }
    cout << dev << endl;
  }
  return 0;
}

```