#include <bits/stdc++.h>
using namespace std;
int n, k;
int num[1000100] = {0};
int a[5500];
bool flag[1000100];
int main() {
  int Max;
  int cnt, mark, mod;
  int i, j, m;
  Max = -1;
  memset(flag, 0, sizeof(flag));
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (Max < a[i]) Max = a[i];
  }
  for (i = 1; i < n; i++) {
    int k;
    for (j = 0; j < i; j++) {
      k = abs(a[i] - a[j]);
      num[k]++;
    }
  }
  int sum;
  for (m = n - k; m <= Max + 1; m++) {
    sum = 0;
    for (i = m; i <= Max; i += m) {
      sum += num[i];
      if (sum > (k * (k + 1) / 2)) break;
    }
    if (sum > (k * (k + 1) / 2)) continue;
    cnt = mark = 0;
    for (j = 0; j < n && (!mark); j++) {
      mod = a[j] % m;
      if (!flag[mod])
        flag[mod] = 1;
      else {
        cnt++;
        if (cnt > k) mark = 1;
      }
    }
    memset(flag, 0, sizeof(flag));
    if (!mark) {
      mark = m;
      break;
    }
  }
  printf("%d\n", mark);
  return 0;
}

### 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;
int num[1000100] = {0};
int a[5500];
bool flag[1000100];
int main() {
  int Max;
  int cnt, mark, mod;
  int i, j, m;
  Max = -1;
  memset(flag, 0, sizeof(flag));
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (Max < a[i]) Max = a[i];
  }
  for (i = 1; i < n; i++) {
    int k;
    for (j = 0; j < i; j++) {
      k = abs(a[i] - a[j]);
      num[k]++;
    }
  }
  int sum;
  for (m = n - k; m <= Max + 1; m++) {
    sum = 0;
    for (i = m; i <= Max; i += m) {
      sum += num[i];
      if (sum > (k * (k + 1) / 2)) break;
    }
    if (sum > (k * (k + 1) / 2)) continue;
    cnt = mark = 0;
    for (j = 0; j < n && (!mark); j++) {
      mod = a[j] % m;
      if (!flag[mod])
        flag[mod] = 1;
      else {
        cnt++;
        if (cnt > k) mark = 1;
      }
    }
    memset(flag, 0, sizeof(flag));
    if (!mark) {
      mark = m;
      break;
    }
  }
  printf("%d\n", mark);
  return 0;
}

```