#include <bits/stdc++.h>
using namespace std;
int a[5005], c[1000005], n;
bool used[1000005];
int main() {
  int i, j, k, m;
  while (~scanf("%d%d", &n, &k)) {
    for (i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n);
    memset(c, 0, sizeof(c));
    for (i = 1; i < n; i++)
      for (j = i; j <= n; j++) c[a[j] - a[i]]++;
    for (i = 1; i <= a[n] + 1; i++) {
      m = 0;
      for (j = i; j <= 1000000; j += i) {
        m += c[j];
        if (m > k * (k + 1) / 2) goto A;
      }
      memset(used, false, sizeof(used));
      m = 0;
      for (j = 1; j <= n; j++) {
        if (used[a[j] % i]) m++;
        used[a[j] % i] = true;
        if (m > k) goto A;
      }
      break;
    A:;
    }
    printf("%d\n", i);
  }
  return 0;
}

### Prompt

Your challenge is to write a cpp solution to 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 a[5005], c[1000005], n;
bool used[1000005];
int main() {
  int i, j, k, m;
  while (~scanf("%d%d", &n, &k)) {
    for (i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n);
    memset(c, 0, sizeof(c));
    for (i = 1; i < n; i++)
      for (j = i; j <= n; j++) c[a[j] - a[i]]++;
    for (i = 1; i <= a[n] + 1; i++) {
      m = 0;
      for (j = i; j <= 1000000; j += i) {
        m += c[j];
        if (m > k * (k + 1) / 2) goto A;
      }
      memset(used, false, sizeof(used));
      m = 0;
      for (j = 1; j <= n; j++) {
        if (used[a[j] % i]) m++;
        used[a[j] % i] = true;
        if (m > k) goto A;
      }
      break;
    A:;
    }
    printf("%d\n", i);
  }
  return 0;
}

```