#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int a[N];
int cnt[N];
int last[N];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    for (int j = 0; j < i; j++) {
      cnt[abs(a[i] - a[j])]++;
    }
  }
  int max_pair = (k + 1) * k / 2;
  for (int d = n - k; d < N; d++) {
    int sz = 0;
    for (int i = 0; i < N; i += d) {
      sz += cnt[i];
      if (sz > max_pair) break;
    }
    if (sz > max_pair) continue;
    int t = 0;
    for (int i = 0; i < n; i++) {
      if (last[a[i] % d] == d) t++;
      last[a[i] % d] = d;
    }
    if (t <= k) {
      cout << d << endl;
      return 0;
    }
  }
  return 0;
}

### Prompt

Develop a solution in CPP 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 N = 1e6 + 5;
int a[N];
int cnt[N];
int last[N];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    for (int j = 0; j < i; j++) {
      cnt[abs(a[i] - a[j])]++;
    }
  }
  int max_pair = (k + 1) * k / 2;
  for (int d = n - k; d < N; d++) {
    int sz = 0;
    for (int i = 0; i < N; i += d) {
      sz += cnt[i];
      if (sz > max_pair) break;
    }
    if (sz > max_pair) continue;
    int t = 0;
    for (int i = 0; i < n; i++) {
      if (last[a[i] % d] == d) t++;
      last[a[i] % d] = d;
    }
    if (t <= k) {
      cout << d << endl;
      return 0;
    }
  }
  return 0;
}

```