#include <bits/stdc++.h>
using namespace std;
int n, K, a[1000010], diff[1000010], tot, maxn;
int flag[1000010];
void Init() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    maxn = max(maxn, a[i]);
  }
}
void solve() {
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) diff[a[j] - a[i]]++;
  int ans;
  for (ans = 1;; ++ans) {
    int ff = 0;
    for (int i = ans; i < maxn; i += ans) ff += diff[i];
    if (ff > (K * (K + 1) >> 1)) continue;
    tot = 0;
    for (int i = 1; i <= n; i++) {
      if (flag[a[i] % ans] == ans) tot++;
      flag[a[i] % ans] = ans;
    }
    if (tot <= K) break;
  }
  printf("%d\n", ans);
}
int main() {
  Init();
  solve();
  return 0;
}

### Prompt

Your task is to create a cpp solution to 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 n, K, a[1000010], diff[1000010], tot, maxn;
int flag[1000010];
void Init() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    maxn = max(maxn, a[i]);
  }
}
void solve() {
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) diff[a[j] - a[i]]++;
  int ans;
  for (ans = 1;; ++ans) {
    int ff = 0;
    for (int i = ans; i < maxn; i += ans) ff += diff[i];
    if (ff > (K * (K + 1) >> 1)) continue;
    tot = 0;
    for (int i = 1; i <= n; i++) {
      if (flag[a[i] % ans] == ans) tot++;
      flag[a[i] % ans] = ans;
    }
    if (tot <= K) break;
  }
  printf("%d\n", ans);
}
int main() {
  Init();
  solve();
  return 0;
}

```