#include <bits/stdc++.h>
using namespace std;
long long const N = 1e6 + 1;
vector<vector<long long> > a(N);
vector<long long> z(N, -1);
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      long long diff = (v[j] - v[i]);
      if (a[diff].size() <= k) {
        a[diff].push_back(i);
      }
    }
  }
  for (int i = 1; i <= 1e6; i++) {
    long long cnt = 0;
    for (int j = 0; j <= 1e6; j += i) {
      int l = 0;
      while (l < a[j].size() && cnt <= k) {
        if (z[a[j][l]] != i) {
          z[a[j][l]] = i;
          cnt++;
        }
        l++;
      }
      if (cnt > k) break;
    }
    if (cnt <= k) {
      cout << i;
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Please formulate 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;
long long const N = 1e6 + 1;
vector<vector<long long> > a(N);
vector<long long> z(N, -1);
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      long long diff = (v[j] - v[i]);
      if (a[diff].size() <= k) {
        a[diff].push_back(i);
      }
    }
  }
  for (int i = 1; i <= 1e6; i++) {
    long long cnt = 0;
    for (int j = 0; j <= 1e6; j += i) {
      int l = 0;
      while (l < a[j].size() && cnt <= k) {
        if (z[a[j][l]] != i) {
          z[a[j][l]] = i;
          cnt++;
        }
        l++;
      }
      if (cnt > k) break;
    }
    if (cnt <= k) {
      cout << i;
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

```