#include <bits/stdc++.h>
using namespace std;
int n, a[5050], b[1001000], k, t[1001000];
void read(void) {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) b[abs(a[i] - a[j])]++;
  for (int i = 1; i < 1001000; ++i)
    for (int j = i + i; j < 1001000; j += i) b[i] += b[j];
}
bool cou(int m) { return b[m] <= k * (k + 1) / 2; }
bool brute(int m) {
  int s = 0;
  for (int i = 0; i < m; ++i) t[i] = 0;
  for (int i = 0; i < n; ++i) t[a[i] % m]++;
  for (int i = 0; i < m; ++i)
    if (t[i] > 0) s = s + t[i] - 1;
  return s <= k;
}
void kill(void) {
  for (int i = 1; i < 1001000; ++i)
    if (cou(i) && brute(i)) {
      cout << i << "\n";
      return;
    }
}
int main() {
  read();
  kill();
  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 n, a[5050], b[1001000], k, t[1001000];
void read(void) {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) b[abs(a[i] - a[j])]++;
  for (int i = 1; i < 1001000; ++i)
    for (int j = i + i; j < 1001000; j += i) b[i] += b[j];
}
bool cou(int m) { return b[m] <= k * (k + 1) / 2; }
bool brute(int m) {
  int s = 0;
  for (int i = 0; i < m; ++i) t[i] = 0;
  for (int i = 0; i < n; ++i) t[a[i] % m]++;
  for (int i = 0; i < m; ++i)
    if (t[i] > 0) s = s + t[i] - 1;
  return s <= k;
}
void kill(void) {
  for (int i = 1; i < 1001000; ++i)
    if (cou(i) && brute(i)) {
      cout << i << "\n";
      return;
    }
}
int main() {
  read();
  kill();
  return 0;
}

```