#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T>
constexpr int infValue =
    std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template <typename T>
constexpr int maxValue =
    std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;
const int INF = infValue<int>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const int MAX = maxValue<int>;
int u[(1000111)], sz;
int n, k;
int a[5010];
int g[(1000111)];
int main(void) {
  scanf("%d %d", &n, &k);
  for (register int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);
  for (register int i = 0; i < n; ++i) {
    for (register int j = 0; j < i; ++j) ++g[a[i] - a[j]];
  }
  for (int j = n - k;; ++j) {
    sz = 0;
    for (int i = j; i < (1000111); i += j) sz += g[i];
    if (k * (k + 1) / 2 < sz) continue;
    sz = 0;
    for (int i = 0; i < n; ++i) {
      if (u[a[i] % j] == j) ++sz;
      u[a[i] % j] = j;
    }
    if (sz <= k) {
      printf("%d\n", j);
      break;
    }
  }
  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>
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T>
constexpr int infValue =
    std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template <typename T>
constexpr int maxValue =
    std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;
const int INF = infValue<int>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const int MAX = maxValue<int>;
int u[(1000111)], sz;
int n, k;
int a[5010];
int g[(1000111)];
int main(void) {
  scanf("%d %d", &n, &k);
  for (register int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);
  for (register int i = 0; i < n; ++i) {
    for (register int j = 0; j < i; ++j) ++g[a[i] - a[j]];
  }
  for (int j = n - k;; ++j) {
    sz = 0;
    for (int i = j; i < (1000111); i += j) sz += g[i];
    if (k * (k + 1) / 2 < sz) continue;
    sz = 0;
    for (int i = 0; i < n; ++i) {
      if (u[a[i] % j] == j) ++sz;
      u[a[i] % j] = j;
    }
    if (sz <= k) {
      printf("%d\n", j);
      break;
    }
  }
  return 0;
}

```