#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[5000];
vector<pair<int, int> > diff[1000000 + 1];
int deleted[1000000 + 1];
int main() {
  cin >> n >> k;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(i); j++) {
      int x = abs(a[i] - a[j]);
      if ((int)diff[x].size() <= k) diff[x].push_back(make_pair(i, j));
    }
  for (int i = 1; i <= 1000000 + 1; i++) {
    int cnt = 0;
    for (int j = i; j <= 1000000; j += i) cnt += diff[j].size();
    if (cnt > k * (k + 1) / 2) continue;
    cnt = 0;
    for (int j = i; j <= 1000000; j += i) {
      for (int k = 0; k < (int)(diff[j].size()); k++) {
        int a = diff[j][k].first;
        int b = diff[j][k].second;
        if (deleted[a] != i && deleted[b] != i) {
          deleted[a] = i;
          ++cnt;
        }
      }
    }
    if (cnt <= k) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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;
int a[5000];
vector<pair<int, int> > diff[1000000 + 1];
int deleted[1000000 + 1];
int main() {
  cin >> n >> k;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(i); j++) {
      int x = abs(a[i] - a[j]);
      if ((int)diff[x].size() <= k) diff[x].push_back(make_pair(i, j));
    }
  for (int i = 1; i <= 1000000 + 1; i++) {
    int cnt = 0;
    for (int j = i; j <= 1000000; j += i) cnt += diff[j].size();
    if (cnt > k * (k + 1) / 2) continue;
    cnt = 0;
    for (int j = i; j <= 1000000; j += i) {
      for (int k = 0; k < (int)(diff[j].size()); k++) {
        int a = diff[j][k].first;
        int b = diff[j][k].second;
        if (deleted[a] != i && deleted[b] != i) {
          deleted[a] = i;
          ++cnt;
        }
      }
    }
    if (cnt <= k) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

```