#include <bits/stdc++.h>
using namespace std;
vector<int> dif[1000123];
int v[1000123];
int foi[1000123];
int existe[1000123];
int main() {
  int n, K;
  cin >> n >> K;
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v, v + n);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (dif[v[j] - v[i]].size() < 2 * (K + 1)) {
        dif[v[j] - v[i]].push_back(v[i]);
        dif[v[j] - v[i]].push_back(v[j]);
      }
    }
  for (int m = 1; m <= 1000000; m++) {
    bool possivel = true;
    int c = 0;
    int precisa = 0;
    vector<int> ves;
    for (int i = m; possivel && i <= 1000000; i += m) {
      if (dif[i].size() >= 2 * (K + 1)) {
        possivel = false;
        continue;
      }
      for (int j = 0; possivel && j < dif[i].size(); j++) {
        int e = dif[i][j];
        if (foi[e]) continue;
        if (existe[e % m]) {
          precisa++;
        } else
          existe[e % m] = 1;
        foi[e] = 1;
        ves.push_back(e);
        if (precisa > K) possivel = false;
      }
    }
    if (possivel) {
      cout << m << endl;
      return 0;
    }
    for (int i = 0; i < ves.size(); i++) {
      existe[ves[i] % m] = 0;
      foi[ves[i]] = 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;
vector<int> dif[1000123];
int v[1000123];
int foi[1000123];
int existe[1000123];
int main() {
  int n, K;
  cin >> n >> K;
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v, v + n);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (dif[v[j] - v[i]].size() < 2 * (K + 1)) {
        dif[v[j] - v[i]].push_back(v[i]);
        dif[v[j] - v[i]].push_back(v[j]);
      }
    }
  for (int m = 1; m <= 1000000; m++) {
    bool possivel = true;
    int c = 0;
    int precisa = 0;
    vector<int> ves;
    for (int i = m; possivel && i <= 1000000; i += m) {
      if (dif[i].size() >= 2 * (K + 1)) {
        possivel = false;
        continue;
      }
      for (int j = 0; possivel && j < dif[i].size(); j++) {
        int e = dif[i][j];
        if (foi[e]) continue;
        if (existe[e % m]) {
          precisa++;
        } else
          existe[e % m] = 1;
        foi[e] = 1;
        ves.push_back(e);
        if (precisa > K) possivel = false;
      }
    }
    if (possivel) {
      cout << m << endl;
      return 0;
    }
    for (int i = 0; i < ves.size(); i++) {
      existe[ves[i] % m] = 0;
      foi[ves[i]] = 0;
    }
  }
  return 0;
}

```