#include <bits/stdc++.h>
using namespace std;
template <class my>
my aabs(const my &a) {
  return (a > 0) ? a : -a;
}
long long int gcd(long long int a, long long int b) {
  return (b == 0) ? a : gcd(b, a % b);
}
long long int LSOne(long long int k) { return (k & (-k)); }
inline int inv(int o) {
  int b = 1000000007, u = 0, v = 1, t, a = o;
  while (a) {
    t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  if (u < 0) u += 1000000007;
  return u;
}
inline int add(const int &a, const int &b) {
  return a + b >= 1000000007 ? a + b - 1000000007 : a + b;
}
inline int sub(const int &a, const int &b) {
  return a - b < 0 ? a - b + 1000000007 : a - b;
}
inline int mul(const int &a, const int &b) {
  return int(a * 1ll * b % 1000000007);
}
inline int _div(const int &a, const int &b) { return mul(a, inv(b)); }
inline int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = mul(ans, a);
    a = mul(a, a);
    b >>= 1;
  }
  return ans;
}
vector<int> diff[1000005];
bool taken[1000005];
bool used[1000005];
void solve() {
  int n, k, temp;
  cin >> n >> k;
  vector<int> arr(n + 5);
  for (int i = 0; i < n; i++) cin >> arr[i];
  if ((n - 1) <= k) {
    cout << 1 << "\n";
    return;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      temp = aabs(arr[i] - arr[j]);
      if (diff[temp].size() <= 2 * k) {
        diff[temp].push_back(arr[i]);
        diff[temp].push_back(arr[j]);
      }
    }
  }
  for (int m = 2; m < 1000002; m++) {
    vector<int> cused;
    int res = 0;
    for (int d = 0; d <= 1000000; d += m) {
      if ((int)diff[d].size() >= 2 * (k + 1)) {
        res = k + 1;
        break;
      }
      for (auto &x : diff[d]) {
        if (used[x]) {
          continue;
        }
        int a = x % m;
        if (taken[a]) {
          ++res;
        } else {
          taken[a] = true;
        }
        used[x] = true;
        cused.push_back(x);
      }
      if (res > k) {
        break;
      }
    }
    if (res <= k) {
      cout << m << "\n";
      return;
    }
    for (auto &it : cused) {
      used[it] = false;
      taken[it % m] = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
  while (t--) solve();
}

### 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;
template <class my>
my aabs(const my &a) {
  return (a > 0) ? a : -a;
}
long long int gcd(long long int a, long long int b) {
  return (b == 0) ? a : gcd(b, a % b);
}
long long int LSOne(long long int k) { return (k & (-k)); }
inline int inv(int o) {
  int b = 1000000007, u = 0, v = 1, t, a = o;
  while (a) {
    t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  if (u < 0) u += 1000000007;
  return u;
}
inline int add(const int &a, const int &b) {
  return a + b >= 1000000007 ? a + b - 1000000007 : a + b;
}
inline int sub(const int &a, const int &b) {
  return a - b < 0 ? a - b + 1000000007 : a - b;
}
inline int mul(const int &a, const int &b) {
  return int(a * 1ll * b % 1000000007);
}
inline int _div(const int &a, const int &b) { return mul(a, inv(b)); }
inline int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = mul(ans, a);
    a = mul(a, a);
    b >>= 1;
  }
  return ans;
}
vector<int> diff[1000005];
bool taken[1000005];
bool used[1000005];
void solve() {
  int n, k, temp;
  cin >> n >> k;
  vector<int> arr(n + 5);
  for (int i = 0; i < n; i++) cin >> arr[i];
  if ((n - 1) <= k) {
    cout << 1 << "\n";
    return;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      temp = aabs(arr[i] - arr[j]);
      if (diff[temp].size() <= 2 * k) {
        diff[temp].push_back(arr[i]);
        diff[temp].push_back(arr[j]);
      }
    }
  }
  for (int m = 2; m < 1000002; m++) {
    vector<int> cused;
    int res = 0;
    for (int d = 0; d <= 1000000; d += m) {
      if ((int)diff[d].size() >= 2 * (k + 1)) {
        res = k + 1;
        break;
      }
      for (auto &x : diff[d]) {
        if (used[x]) {
          continue;
        }
        int a = x % m;
        if (taken[a]) {
          ++res;
        } else {
          taken[a] = true;
        }
        used[x] = true;
        cused.push_back(x);
      }
      if (res > k) {
        break;
      }
    }
    if (res <= k) {
      cout << m << "\n";
      return;
    }
    for (auto &it : cused) {
      used[it] = false;
      taken[it % m] = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
  while (t--) solve();
}

```