#include <bits/stdc++.h>
using namespace std;
int p[5050], C[1000010];
int chk[1000010];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int i;
  for (i = 1; i <= n; i++) scanf("%d", p + i);
  sort(p + 1, p + 1 + n);
  for (i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) chk[p[j] - p[i]]++;
  }
  for (i = 1; i <= 1e6 + 5; i++) {
    int counter = 0;
    int j;
    for (j = i; j <= 1e6 + 5; j += i) counter += chk[j];
    if (counter > k * (k + 1) / 2) continue;
    counter = 0;
    for (j = 1; j <= n; j++) {
      if (C[p[j] % i] == i)
        counter++;
      else
        C[p[j] % i] = i;
    }
    if (counter <= k) {
      printf("%d", i);
      break;
    }
  }
  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 p[5050], C[1000010];
int chk[1000010];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int i;
  for (i = 1; i <= n; i++) scanf("%d", p + i);
  sort(p + 1, p + 1 + n);
  for (i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) chk[p[j] - p[i]]++;
  }
  for (i = 1; i <= 1e6 + 5; i++) {
    int counter = 0;
    int j;
    for (j = i; j <= 1e6 + 5; j += i) counter += chk[j];
    if (counter > k * (k + 1) / 2) continue;
    counter = 0;
    for (j = 1; j <= n; j++) {
      if (C[p[j] % i] == i)
        counter++;
      else
        C[p[j] % i] = i;
    }
    if (counter <= k) {
      printf("%d", i);
      break;
    }
  }
  return 0;
}

```