#include <bits/stdc++.h>
using namespace std;
int N, K, a[1000005], f[1000005], b[1000005];
void solve(int ncase) {
  int i, j, res, cnt;
  scanf("%d%d", &N, &K);
  for (i = 0; i < N; i++) scanf("%d", a + i);
  sort(a, a + N);
  for (i = 0; i < N; i++)
    for (j = i + 1; j < N; j++) f[a[j] - a[i]]++;
  for (i = 1;; i++) {
    cnt = res = 0;
    for (j = i; j < 1000005; j += i) cnt += f[j];
    if (cnt > K * (K + 1) / 2) continue;
    for (j = 0; j < N; j++) {
      if (b[a[j] % i] == i) res++;
      b[a[j] % i] = i;
    }
    if (res <= K) break;
  }
  printf("%d\n", i);
}
int main() {
  int T = 1;
  int ncase = 0;
  while (T--) {
    solve(++ncase);
  }
}

### Prompt

In cpp, your task is to solve 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, a[1000005], f[1000005], b[1000005];
void solve(int ncase) {
  int i, j, res, cnt;
  scanf("%d%d", &N, &K);
  for (i = 0; i < N; i++) scanf("%d", a + i);
  sort(a, a + N);
  for (i = 0; i < N; i++)
    for (j = i + 1; j < N; j++) f[a[j] - a[i]]++;
  for (i = 1;; i++) {
    cnt = res = 0;
    for (j = i; j < 1000005; j += i) cnt += f[j];
    if (cnt > K * (K + 1) / 2) continue;
    for (j = 0; j < N; j++) {
      if (b[a[j] % i] == i) res++;
      b[a[j] % i] = i;
    }
    if (res <= K) break;
  }
  printf("%d\n", i);
}
int main() {
  int T = 1;
  int ncase = 0;
  while (T--) {
    solve(++ncase);
  }
}

```