#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int a[maxn], n, k, re[maxn], h[maxn];
int main() {
  int ma = -1;
  scanf("%d%d", &n, &k);
  memset(re, 0, sizeof(re));
  memset(h, 0, sizeof(h));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (ma < a[i]) ma = a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++) {
      int tmp = a[i] - a[j] > 0 ? a[i] - a[j] : a[j] - a[i];
      h[tmp]++;
    }
  }
  int res, flag = 1;
  for (int m = 1; m <= maxn + 1; m++) {
    int tk = k;
    int sum = 0;
    flag = 1;
    for (int i = m; i <= 1e6; i += m) {
      sum += h[i];
      if (sum > k * (k + 1) / 2) break;
    }
    if (sum > k * (k + 1) / 2) continue;
    res = m;
    for (int i = 1; i <= n; i++) {
      if (!re[a[i] % res])
        re[a[i] % res]++;
      else {
        tk--;
        if (tk < 0) {
          flag = 0;
          break;
        }
      }
    }
    memset(re, 0, sizeof(re));
    if (flag) break;
  }
  printf("%d\n", res);
}

### 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;
const int maxn = 1e6 + 5;
int a[maxn], n, k, re[maxn], h[maxn];
int main() {
  int ma = -1;
  scanf("%d%d", &n, &k);
  memset(re, 0, sizeof(re));
  memset(h, 0, sizeof(h));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (ma < a[i]) ma = a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++) {
      int tmp = a[i] - a[j] > 0 ? a[i] - a[j] : a[j] - a[i];
      h[tmp]++;
    }
  }
  int res, flag = 1;
  for (int m = 1; m <= maxn + 1; m++) {
    int tk = k;
    int sum = 0;
    flag = 1;
    for (int i = m; i <= 1e6; i += m) {
      sum += h[i];
      if (sum > k * (k + 1) / 2) break;
    }
    if (sum > k * (k + 1) / 2) continue;
    res = m;
    for (int i = 1; i <= n; i++) {
      if (!re[a[i] % res])
        re[a[i] % res]++;
      else {
        tk--;
        if (tk < 0) {
          flag = 0;
          break;
        }
      }
    }
    memset(re, 0, sizeof(re));
    if (flag) break;
  }
  printf("%d\n", res);
}

```