#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> arr;
int md[1000001];
int dif[1000001];
bool cont(int a) {
  for (int i = 0; i < a; i++) md[i] = 0;
  for (int i = 0; i < n; i++) md[arr[i] % a]++;
  int b = 0;
  for (int i = 0; i < a; i++)
    if (md[i] != 0) b += (md[i] - 1);
  if (b <= k)
    return true;
  else
    return false;
}
int main() {
  cin >> n >> k;
  int oku;
  for (int i = 0; i < n; i++) {
    cin >> oku;
    arr.push_back(oku);
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) dif[abs(arr[j] - arr[i])]++;
  int it;
  int sum;
  for (it = n - k;; it++) {
    sum = 0;
    for (int j = it; j <= 1000000; j = j + it) sum += dif[j];
    if ((dif[it] <= k) && (sum <= k * (k + 1) / 2) && cont(it)) break;
  }
  cout << it << endl;
  return 0;
}

### Prompt

Please create a solution in CPP 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;
int n, k;
vector<int> arr;
int md[1000001];
int dif[1000001];
bool cont(int a) {
  for (int i = 0; i < a; i++) md[i] = 0;
  for (int i = 0; i < n; i++) md[arr[i] % a]++;
  int b = 0;
  for (int i = 0; i < a; i++)
    if (md[i] != 0) b += (md[i] - 1);
  if (b <= k)
    return true;
  else
    return false;
}
int main() {
  cin >> n >> k;
  int oku;
  for (int i = 0; i < n; i++) {
    cin >> oku;
    arr.push_back(oku);
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) dif[abs(arr[j] - arr[i])]++;
  int it;
  int sum;
  for (it = n - k;; it++) {
    sum = 0;
    for (int j = it; j <= 1000000; j = j + it) sum += dif[j];
    if ((dif[it] <= k) && (sum <= k * (k + 1) / 2) && cont(it)) break;
  }
  cout << it << endl;
  return 0;
}

```