#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int Mod = 1000000007LL;
const int N = 1e6 + 10;
const int Log = 30;
int V[N][23];
int p[N];
int cnt[N];
int a[N];
vector<int> C;
int cp[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int dd;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < i; j++) {
      dd = abs(a[i] - a[j]);
      cnt[dd]++;
      if (p[dd] <= 20) {
        V[dd][p[dd]++] = i;
        V[dd][p[dd]++] = j;
      }
    }
  }
  for (int i = 1; i < N; i++) {
    int sm = 0;
    for (int j = i; j < N; j += i) {
      sm += cnt[j];
      if (sm > 25) break;
    }
    if (sm > 25) continue;
    C.clear();
    for (int j = i; j < N; j += i) {
      for (int k = 0; k < p[j]; k++) C.push_back(V[j][k]);
    }
    sort(C.begin(), C.end());
    C.resize(unique(C.begin(), C.end()) - C.begin());
    if (C.size() > 10) continue;
    for (auto &x : C) x = a[x] % i;
    for (auto x : C) cp[x]++;
    sm = 0;
    for (auto x : C) {
      if (cp[x]) {
        sm += cp[x] - 1;
        cp[x] = 0;
      }
    }
    if (sm <= k) return cout << i << '\n', 0;
  }
  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>
#pragma GCC optimize("Ofast")
using namespace std;
const int Mod = 1000000007LL;
const int N = 1e6 + 10;
const int Log = 30;
int V[N][23];
int p[N];
int cnt[N];
int a[N];
vector<int> C;
int cp[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int dd;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < i; j++) {
      dd = abs(a[i] - a[j]);
      cnt[dd]++;
      if (p[dd] <= 20) {
        V[dd][p[dd]++] = i;
        V[dd][p[dd]++] = j;
      }
    }
  }
  for (int i = 1; i < N; i++) {
    int sm = 0;
    for (int j = i; j < N; j += i) {
      sm += cnt[j];
      if (sm > 25) break;
    }
    if (sm > 25) continue;
    C.clear();
    for (int j = i; j < N; j += i) {
      for (int k = 0; k < p[j]; k++) C.push_back(V[j][k]);
    }
    sort(C.begin(), C.end());
    C.resize(unique(C.begin(), C.end()) - C.begin());
    if (C.size() > 10) continue;
    for (auto &x : C) x = a[x] % i;
    for (auto x : C) cp[x]++;
    sm = 0;
    for (auto x : C) {
      if (cp[x]) {
        sm += cp[x] - 1;
        cp[x] = 0;
      }
    }
    if (sm <= k) return cout << i << '\n', 0;
  }
  return 0;
}

```