#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  while (cin >> n >> k) {
    vector<int> a(n);
    for (int i = 0; i < n; scanf("%d", &a[i++]))
      ;
    sort(a.begin(), a.end());
    vector<int> dif(1e6 + 10, 0);
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) dif[a[j] - a[i]]++;
    }
    vector<int> m(1e6 + 10, 0);
    int res = 0;
    while (++res) {
      int tmp = 0;
      for (int i = res; i < 1e6 + 10; i += res) tmp += dif[i];
      if (tmp > k * (k + 1) / 2) continue;
      tmp = 0;
      for (int i = 0; i < n; i++)
        tmp += (m[a[i] % res] == res), m[a[i] % res] = res;
      if (tmp <= k) break;
    }
    cout << res << endl;
  }
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

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 main() {
  int n, k;
  while (cin >> n >> k) {
    vector<int> a(n);
    for (int i = 0; i < n; scanf("%d", &a[i++]))
      ;
    sort(a.begin(), a.end());
    vector<int> dif(1e6 + 10, 0);
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) dif[a[j] - a[i]]++;
    }
    vector<int> m(1e6 + 10, 0);
    int res = 0;
    while (++res) {
      int tmp = 0;
      for (int i = res; i < 1e6 + 10; i += res) tmp += dif[i];
      if (tmp > k * (k + 1) / 2) continue;
      tmp = 0;
      for (int i = 0; i < n; i++)
        tmp += (m[a[i] % res] == res), m[a[i] % res] = res;
      if (tmp <= k) break;
    }
    cout << res << endl;
  }
  return 0;
}

```