#include <bits/stdc++.h>
using namespace std;
int a[5555], n, k;
int cnt[1111111];
int seen[1111111];
int main() {
  int i, j;
  cin >> n >> k;
  for (i = 1; i <= n; ++i) cin >> a[i];
  for (i = 1; i <= n; ++i) {
    for (j = i + 1; j <= n; ++j) {
      int dd = a[i] - a[j];
      if (dd < 0) dd = -dd;
      cnt[dd]++;
    }
  }
  int m;
  for (m = n - k;; ++m) {
    int bad = 0;
    for (j = m; j <= 1000000; j += m) bad += cnt[j];
    if (bad > (k * (k + 1)) / 2) continue;
    int need = 0;
    for (j = 1; j <= n; ++j) {
      int md = a[j] % m;
      if (seen[md] == m)
        need++;
      else
        seen[md] = m;
    }
    if (need <= k) break;
  }
  cout << m;
  return 0;
}

### Prompt

Create a solution in Cpp for 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 a[5555], n, k;
int cnt[1111111];
int seen[1111111];
int main() {
  int i, j;
  cin >> n >> k;
  for (i = 1; i <= n; ++i) cin >> a[i];
  for (i = 1; i <= n; ++i) {
    for (j = i + 1; j <= n; ++j) {
      int dd = a[i] - a[j];
      if (dd < 0) dd = -dd;
      cnt[dd]++;
    }
  }
  int m;
  for (m = n - k;; ++m) {
    int bad = 0;
    for (j = m; j <= 1000000; j += m) bad += cnt[j];
    if (bad > (k * (k + 1)) / 2) continue;
    int need = 0;
    for (j = 1; j <= n; ++j) {
      int md = a[j] % m;
      if (seen[md] == m)
        need++;
      else
        seen[md] = m;
    }
    if (need <= k) break;
  }
  cout << m;
  return 0;
}

```