#include <bits/stdc++.h>
using namespace std;
int a[5005], s[1000001], has[1000001];
int Abs(int n) {
  if (n < 0) return -n;
  return n;
}
int main() {
  int n, k, i, j;
  while (~scanf("%d%d", &n, &k)) {
    for (i = 0; i < n; i++) scanf("%d", a + i);
    memset(has, 0, sizeof(has));
    memset(s, 0, sizeof(s));
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) ++s[Abs(a[i] - a[j])];
    }
    int maxs = k * (k + 1) / 2;
    for (i = max(n - k, 1);; i++) {
      int cnt = 0;
      for (j = i; j < 1000001; j += i) cnt += s[j];
      if (cnt > maxs) continue;
      cnt = 0;
      for (j = 0; j < n; j++) {
        int v = a[j] % i;
        if (has[v] == i)
          ++cnt;
        else
          has[v] = i;
      }
      if (cnt <= k) break;
    }
    printf("%d\n", i);
  }
  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;
int a[5005], s[1000001], has[1000001];
int Abs(int n) {
  if (n < 0) return -n;
  return n;
}
int main() {
  int n, k, i, j;
  while (~scanf("%d%d", &n, &k)) {
    for (i = 0; i < n; i++) scanf("%d", a + i);
    memset(has, 0, sizeof(has));
    memset(s, 0, sizeof(s));
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) ++s[Abs(a[i] - a[j])];
    }
    int maxs = k * (k + 1) / 2;
    for (i = max(n - k, 1);; i++) {
      int cnt = 0;
      for (j = i; j < 1000001; j += i) cnt += s[j];
      if (cnt > maxs) continue;
      cnt = 0;
      for (j = 0; j < n; j++) {
        int v = a[j] % i;
        if (has[v] == i)
          ++cnt;
        else
          has[v] = i;
      }
      if (cnt <= k) break;
    }
    printf("%d\n", i);
  }
  return 0;
}

```