#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int f[N + 5], vis[N + 5], v[N + 5];
int main() {
  int n, k, x;
  scanf("%d%d", &n, &k);
  if (n - 1 <= k) return puts("1"), 0;
  for (int i = 0; i < n; i++) scanf("%d", vis + i);
  sort(vis, vis + n);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) f[vis[j] - vis[i]]++;
  for (int i = n - k; i <= vis[n - 1] + 1; i++) {
    int cnt = 0;
    for (int j = 1; j * i <= vis[n - 1] + 1; j++) {
      cnt += f[i * j];
      if (cnt > k * (k + 1) / 2) break;
    }
    if (cnt > k * (k + 1) / 2) continue;
    cnt = 0;
    for (int j = 0; j < n; j++) {
      int now = vis[j] % i;
      if (v[now] != i)
        v[now] = i;
      else
        cnt++;
      if (cnt > k) break;
    }
    if (cnt <= k) {
      printf("%d\n", i);
      break;
    }
  }
  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 N = 1e6;
int f[N + 5], vis[N + 5], v[N + 5];
int main() {
  int n, k, x;
  scanf("%d%d", &n, &k);
  if (n - 1 <= k) return puts("1"), 0;
  for (int i = 0; i < n; i++) scanf("%d", vis + i);
  sort(vis, vis + n);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) f[vis[j] - vis[i]]++;
  for (int i = n - k; i <= vis[n - 1] + 1; i++) {
    int cnt = 0;
    for (int j = 1; j * i <= vis[n - 1] + 1; j++) {
      cnt += f[i * j];
      if (cnt > k * (k + 1) / 2) break;
    }
    if (cnt > k * (k + 1) / 2) continue;
    cnt = 0;
    for (int j = 0; j < n; j++) {
      int now = vis[j] % i;
      if (v[now] != i)
        v[now] = i;
      else
        cnt++;
      if (cnt > k) break;
    }
    if (cnt <= k) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}

```