#include <bits/stdc++.h>
using namespace std;
int f[5500];
bool r[1001000];
int x[1001000];
int ff[5] = {0, 1, 3, 6, 10};
int tmp;
int n, K;
bool check(int i) {
  tmp = 0;
  for (int k = i; k <= f[n]; k += i) {
    tmp += x[k];
    if (tmp > ff[K]) return false;
  }
  tmp = 0;
  memset(r, 0, sizeof(r));
  for (int k = 1; k <= n; k++) {
    tmp += (int)r[f[k] % i];
    r[f[k] % i] = true;
    if (tmp > K) return false;
  }
  return true;
}
int main() {
  while (~scanf("%d%d", &n, &K)) {
    memset(x, 0, sizeof(x));
    for (int i = 1; i <= n; i++) scanf("%d", &f[i]);
    sort(f + 1, f + n + 1);
    for (int i = 1; i < n; i++)
      for (int j = i + 1; j <= n; j++) {
        x[f[j] - f[i]]++;
      }
    for (int i = 1;; i++) {
      if (check(i)) {
        printf("%d\n", i);
        break;
      }
    }
  }
  return 0;
}

### Prompt

Develop a solution in Cpp to the problem described below:

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 f[5500];
bool r[1001000];
int x[1001000];
int ff[5] = {0, 1, 3, 6, 10};
int tmp;
int n, K;
bool check(int i) {
  tmp = 0;
  for (int k = i; k <= f[n]; k += i) {
    tmp += x[k];
    if (tmp > ff[K]) return false;
  }
  tmp = 0;
  memset(r, 0, sizeof(r));
  for (int k = 1; k <= n; k++) {
    tmp += (int)r[f[k] % i];
    r[f[k] % i] = true;
    if (tmp > K) return false;
  }
  return true;
}
int main() {
  while (~scanf("%d%d", &n, &K)) {
    memset(x, 0, sizeof(x));
    for (int i = 1; i <= n; i++) scanf("%d", &f[i]);
    sort(f + 1, f + n + 1);
    for (int i = 1; i < n; i++)
      for (int j = i + 1; j <= n; j++) {
        x[f[j] - f[i]]++;
      }
    for (int i = 1;; i++) {
      if (check(i)) {
        printf("%d\n", i);
        break;
      }
    }
  }
  return 0;
}

```