#include <bits/stdc++.h>
using namespace std;
const long long MAXM = 1000000 + 10;
long long num[MAXM];
bool vis[MAXM];
long long cnt[MAXM];
long long n, k;
bool check(long long m) {
  memset(vis, false, sizeof(vis));
  long long cnt = 0;
  for (long long i = 0; i < n; ++i) {
    long long var = num[i] % m;
    if (!vis[var]) {
      vis[var] = true;
    } else {
      cnt++;
    }
    if (cnt > k) return false;
  }
  return true;
}
int main() {
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> num[i];
  }
  memset(cnt, 0, sizeof(cnt));
  sort(num, num + n);
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      cnt[abs(num[i] - num[j])]++;
    }
  }
  long long vark = 0;
  for (long long m = 1; m < MAXM; ++m) {
    vark = 0;
    for (long long tmp = m; tmp < MAXM; tmp += m) {
      vark += cnt[tmp];
      if (vark > (k + 1) * k / 2) break;
    }
    if (vark <= (k + 1) * k / 2 && check(m)) {
      cout << m << 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 long long MAXM = 1000000 + 10;
long long num[MAXM];
bool vis[MAXM];
long long cnt[MAXM];
long long n, k;
bool check(long long m) {
  memset(vis, false, sizeof(vis));
  long long cnt = 0;
  for (long long i = 0; i < n; ++i) {
    long long var = num[i] % m;
    if (!vis[var]) {
      vis[var] = true;
    } else {
      cnt++;
    }
    if (cnt > k) return false;
  }
  return true;
}
int main() {
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> num[i];
  }
  memset(cnt, 0, sizeof(cnt));
  sort(num, num + n);
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      cnt[abs(num[i] - num[j])]++;
    }
  }
  long long vark = 0;
  for (long long m = 1; m < MAXM; ++m) {
    vark = 0;
    for (long long tmp = m; tmp < MAXM; tmp += m) {
      vark += cnt[tmp];
      if (vark > (k + 1) * k / 2) break;
    }
    if (vark <= (k + 1) * k / 2 && check(m)) {
      cout << m << endl;
      return 0;
    }
  }
  return 0;
}

```