#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int max_dis = 0, dis_i = 0;
  vector<int> a = vector<int>(5000);
  vector<int> dis = vector<int>(1000001);
  vector<int> m = vector<int>(1000001);
  cin >> n >> k;
  if (n <= k || n < 0 || k < 0) {
    return cout << "0\n", 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < i; j++) {
      dis_i = abs(a[j] - a[i]);
      dis[dis_i]++;
      if (max_dis < dis_i) max_dis = dis_i;
    }
  }
  int s = 0;
  for (int mod = n - k; mod < 1000001; mod++) {
    for (int i = mod << 1; i < 1000001; i = i + mod)
      dis[mod] = dis[mod] + dis[i];
    if (dis[mod] <= k * (k + 1) >> 1) {
      int c = 0;
      for (int i = 0; i < n; i++) {
        c = c + (m[a[i] % mod] == mod);
        m[a[i] % mod] = mod;
      }
      if (c <= k) {
        return cout << mod << endl, 0;
      }
    }
  }
  return 0;
}

### Prompt

Your task is to create 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;
int main() {
  int n, k;
  int max_dis = 0, dis_i = 0;
  vector<int> a = vector<int>(5000);
  vector<int> dis = vector<int>(1000001);
  vector<int> m = vector<int>(1000001);
  cin >> n >> k;
  if (n <= k || n < 0 || k < 0) {
    return cout << "0\n", 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < i; j++) {
      dis_i = abs(a[j] - a[i]);
      dis[dis_i]++;
      if (max_dis < dis_i) max_dis = dis_i;
    }
  }
  int s = 0;
  for (int mod = n - k; mod < 1000001; mod++) {
    for (int i = mod << 1; i < 1000001; i = i + mod)
      dis[mod] = dis[mod] + dis[i];
    if (dis[mod] <= k * (k + 1) >> 1) {
      int c = 0;
      for (int i = 0; i < n; i++) {
        c = c + (m[a[i] % mod] == mod);
        m[a[i] % mod] = mod;
      }
      if (c <= k) {
        return cout << mod << endl, 0;
      }
    }
  }
  return 0;
}

```