#include <bits/stdc++.h>
using namespace std;
int i, j, n, k, a[5005], rs, diff[1000005], sum, last[1000005], now, used;
vector<pair<int, int>> pdif;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  if (n <= k || n == 1) return cout << "1\n", 0;
  for (i = 1, rs = n - k; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; ++i)
    for (j = i + 1; j <= n; ++j) ++diff[a[j] - a[i]];
  for (rs = n - k;; ++rs) {
    for (i = rs, sum = 0; i <= 1e6; i += rs) sum += diff[i];
    if (2 * sum > k * (k + 1)) continue;
    for (i = 1, used = k; i <= n && used > -1; ++i) {
      now = a[i] % rs;
      if (!last[now])
        last[now] = i;
      else
        --used;
    }
    if (used > -1) return cout << rs << '\n', 0;
    while ((i--) > 0) last[a[i] % rs] = 0;
  }
  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 i, j, n, k, a[5005], rs, diff[1000005], sum, last[1000005], now, used;
vector<pair<int, int>> pdif;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  if (n <= k || n == 1) return cout << "1\n", 0;
  for (i = 1, rs = n - k; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; ++i)
    for (j = i + 1; j <= n; ++j) ++diff[a[j] - a[i]];
  for (rs = n - k;; ++rs) {
    for (i = rs, sum = 0; i <= 1e6; i += rs) sum += diff[i];
    if (2 * sum > k * (k + 1)) continue;
    for (i = 1, used = k; i <= n && used > -1; ++i) {
      now = a[i] % rs;
      if (!last[now])
        last[now] = i;
      else
        --used;
    }
    if (used > -1) return cout << rs << '\n', 0;
    while ((i--) > 0) last[a[i] % rs] = 0;
  }
  return 0;
}

```