#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void Read(T &x) {
  x = 0;
  bool flag = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  if (flag) x = -x;
}
int n = 0, k = 0;
int num[5010], d[1000010];
bool vis[1000010];
inline bool check(int m) {
  memset(vis, 0, sizeof(vis));
  int r = 0, cnt = 0;
  for (int i = 1; i <= n; ++i) {
    r = num[i] % m;
    if (vis[r]) {
      cnt++;
      if (cnt > k) return false;
    }
    vis[r] = true;
  }
  if (cnt <= k) return true;
}
int main() {
  Read(n);
  Read(k);
  for (int i = 1; i <= n; ++i) Read(num[i]);
  sort(num + 1, num + n + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j < i; ++j) d[num[i] - num[j]]++;
  int c = 0, ans = 1, m = num[n] + 1, t = k * (k + 1) / 2;
  for (; ans <= m; ++ans) {
    c = 0;
    for (int j = ans; j <= m; j += ans) c += d[j];
    if (c <= t && check(ans)) break;
  }
  printf("%d\n", ans);
  return 0;
}

### Prompt

Generate 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;
template <class T>
inline void Read(T &x) {
  x = 0;
  bool flag = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  if (flag) x = -x;
}
int n = 0, k = 0;
int num[5010], d[1000010];
bool vis[1000010];
inline bool check(int m) {
  memset(vis, 0, sizeof(vis));
  int r = 0, cnt = 0;
  for (int i = 1; i <= n; ++i) {
    r = num[i] % m;
    if (vis[r]) {
      cnt++;
      if (cnt > k) return false;
    }
    vis[r] = true;
  }
  if (cnt <= k) return true;
}
int main() {
  Read(n);
  Read(k);
  for (int i = 1; i <= n; ++i) Read(num[i]);
  sort(num + 1, num + n + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j < i; ++j) d[num[i] - num[j]]++;
  int c = 0, ans = 1, m = num[n] + 1, t = k * (k + 1) / 2;
  for (; ans <= m; ++ans) {
    c = 0;
    for (int j = ans; j <= m; j += ans) c += d[j];
    if (c <= t && check(ans)) break;
  }
  printf("%d\n", ans);
  return 0;
}

```