#include <bits/stdc++.h>
using namespace std;
int arr[5050], d[1000005], mod[1000005], n, k, mx, cnt, tot;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1);
  mx = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      d[arr[j] - arr[i]]++;
      mx = max(mx, arr[j] - arr[i]);
    }
  }
  for (int i = 1;; i++) {
    tot = 0;
    for (int j = i; j <= mx; j += i) tot += d[j];
    if (tot > k * (k + 1) / 2) continue;
    cnt = 0;
    for (int j = 1; j <= n; j++) {
      if (mod[arr[j] % i] == i) cnt++;
      mod[arr[j] % i] = i;
    }
    if (cnt <= k) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

### Prompt

Please formulate 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 arr[5050], d[1000005], mod[1000005], n, k, mx, cnt, tot;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1);
  mx = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      d[arr[j] - arr[i]]++;
      mx = max(mx, arr[j] - arr[i]);
    }
  }
  for (int i = 1;; i++) {
    tot = 0;
    for (int j = i; j <= mx; j += i) tot += d[j];
    if (tot > k * (k + 1) / 2) continue;
    cnt = 0;
    for (int j = 1; j <= n; j++) {
      if (mod[arr[j] % i] == i) cnt++;
      mod[arr[j] % i] = i;
    }
    if (cnt <= k) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

```