#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e6;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto &ai : a) cin >> ai;
  sort(begin(a), end(a));
  vector<int> cnt_d(MAX + 1);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) {
      cnt_d[a[i] - a[j]]++;
    }
  vector<int> cnt(MAX + 1);
  auto check = [&](int m) {
    int sum = 0, lim = k * (k + 1) / 2;
    for (int i = m; i <= MAX; i += m) {
      if ((sum += cnt_d[i]) > lim) return false;
    }
    int dup = 0;
    cnt.assign(m, 0);
    for (int ai : a)
      if (cnt[ai % m]++ && ++dup > k) return false;
    return true;
  };
  int mod = 1;
  while (!check(mod)) mod++;
  cout << mod << endl;
  return 0;
}

### Prompt

In cpp, your task is to solve 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 MAX = (int)1e6;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto &ai : a) cin >> ai;
  sort(begin(a), end(a));
  vector<int> cnt_d(MAX + 1);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) {
      cnt_d[a[i] - a[j]]++;
    }
  vector<int> cnt(MAX + 1);
  auto check = [&](int m) {
    int sum = 0, lim = k * (k + 1) / 2;
    for (int i = m; i <= MAX; i += m) {
      if ((sum += cnt_d[i]) > lim) return false;
    }
    int dup = 0;
    cnt.assign(m, 0);
    for (int ai : a)
      if (cnt[ai % m]++ && ++dup > k) return false;
    return true;
  };
  int mod = 1;
  while (!check(mod)) mod++;
  cout << mod << endl;
  return 0;
}

```