#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, k, a[5007], c[N], r[N];
int solve() {
  sort(a, a + n);
  for (int i = (0); i < (n); ++i)
    for (int j = (i + 1); j < (n); ++j) ++c[a[j] - a[i]];
  int lim = k * (k + 1) >> 1, timeStamp = 0;
  for (int m = (1); m < (N); ++m) {
    int sum = 0;
    for (int i = m; i < N && sum <= lim; i += m) sum += c[i];
    if (sum > lim) continue;
    ++timeStamp, sum = 0;
    for (int i = (0); i < (n); ++i)
      if (r[a[i] % m] != timeStamp) {
        r[a[i] % m] = timeStamp;
      } else {
        ++sum;
        if (sum > k) break;
      }
    if (sum <= k) return m;
  }
  return -1;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  printf("%d", solve());
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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 N = 1e6 + 7;
int n, k, a[5007], c[N], r[N];
int solve() {
  sort(a, a + n);
  for (int i = (0); i < (n); ++i)
    for (int j = (i + 1); j < (n); ++j) ++c[a[j] - a[i]];
  int lim = k * (k + 1) >> 1, timeStamp = 0;
  for (int m = (1); m < (N); ++m) {
    int sum = 0;
    for (int i = m; i < N && sum <= lim; i += m) sum += c[i];
    if (sum > lim) continue;
    ++timeStamp, sum = 0;
    for (int i = (0); i < (n); ++i)
      if (r[a[i] % m] != timeStamp) {
        r[a[i] % m] = timeStamp;
      } else {
        ++sum;
        if (sum > k) break;
      }
    if (sum <= k) return m;
  }
  return -1;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  printf("%d", solve());
  return 0;
}

```