#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 10;
int n, k;
int a[maxn];
int t[1001 * 1001];
int d[1001 * 1001];
int m[1001 * 1001];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) t[abs(a[i] - a[j])]++;
  for (int i = 1; i <= 1000010; ++i)
    for (int j = i; j <= 1000010; j += i) d[i] += t[j];
  for (int i = 1; i <= 1000010; ++i)
    if (d[i] <= (k * (k + 1)) / 2 || d[i] <= k) {
      int z = 0;
      for (int j = 1; j <= n; ++j) {
        m[a[j] % i]++;
        if (m[a[j] % i] >= 2) z++;
        if (z > k) break;
      }
      for (int j = 1; j <= n; ++j) m[a[j] % i] = 0;
      if (z <= k) {
        cout << i << endl;
        return 0;
      }
    }
  return 0;
}

### Prompt

Please provide a cpp coded solution 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;
const int maxn = 5000 + 10;
int n, k;
int a[maxn];
int t[1001 * 1001];
int d[1001 * 1001];
int m[1001 * 1001];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) t[abs(a[i] - a[j])]++;
  for (int i = 1; i <= 1000010; ++i)
    for (int j = i; j <= 1000010; j += i) d[i] += t[j];
  for (int i = 1; i <= 1000010; ++i)
    if (d[i] <= (k * (k + 1)) / 2 || d[i] <= k) {
      int z = 0;
      for (int j = 1; j <= n; ++j) {
        m[a[j] % i]++;
        if (m[a[j] % i] >= 2) z++;
        if (z > k) break;
      }
      for (int j = 1; j <= n; ++j) m[a[j] % i] = 0;
      if (z <= k) {
        cout << i << endl;
        return 0;
      }
    }
  return 0;
}

```