#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 50;
const int maxm = 1000010;
int cou[maxm], num[maxn], cnt[maxm];
int n, k;
bool check(int m) {
  int ans = 0, sum = 0;
  for (int i = 0; i <= 1000000; i += m) sum += cou[i];
  if (sum > (k + 1) * k / 2) return false;
  for (int i = 0; i < n; i++) {
    ans += (cnt[num[i] % m] == m);
    if (ans > k) return false;
    cnt[num[i] % m] = m;
  }
  return true;
}
int main() {
  memset(cou, 0, sizeof(cou));
  memset(cnt, 0, sizeof(cnt));
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> num[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) cou[abs(num[i] - num[j])]++;
  int ans = n - k;
  while (!check(ans)) ans++;
  cout << ans << endl;
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

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 maxn = 5000 + 50;
const int maxm = 1000010;
int cou[maxm], num[maxn], cnt[maxm];
int n, k;
bool check(int m) {
  int ans = 0, sum = 0;
  for (int i = 0; i <= 1000000; i += m) sum += cou[i];
  if (sum > (k + 1) * k / 2) return false;
  for (int i = 0; i < n; i++) {
    ans += (cnt[num[i] % m] == m);
    if (ans > k) return false;
    cnt[num[i] % m] = m;
  }
  return true;
}
int main() {
  memset(cou, 0, sizeof(cou));
  memset(cnt, 0, sizeof(cnt));
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> num[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) cou[abs(num[i] - num[j])]++;
  int ans = n - k;
  while (!check(ans)) ans++;
  cout << ans << endl;
  return 0;
}

```