#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INFI = 1e9;
const long long INFIL = 1e17;
const int N = 1111111;
const int M = 5555;
const int move[8][2] = {1, 0, -1, 0, 0, 1, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1};
int a[M], cnt[N], n, k;
bool vis[N];
int abs(int x) { return x > 0 ? x : -x; }
bool check(int x) {
  int sum = 0, t;
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    t = a[i] % x;
    if (!vis[t])
      vis[t] = 1;
    else
      sum++;
  }
  return sum <= k;
}
int main() {
  int m, sum, t;
  while (scanf("%d%d", &n, &k) != EOF) {
    memset(cnt, 0, sizeof(cnt));
    m = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      m = max(m, a[i]);
      for (int j = 0; j < i; j++) cnt[abs(a[i] - a[j])]++;
    }
    m++;
    t = k * (k + 1) / 2;
    for (int i = 1; i < m; i++) {
      sum = 0;
      for (int j = i; j < m; j += i) {
        sum += cnt[j];
        if (sum > t) break;
      }
      if (sum <= t && check(i)) {
        printf("%d\n", i);
        break;
      }
    }
  }
  return 0;
}

### Prompt

Please provide a Cpp coded solution 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;
const int MOD = 1e9 + 7;
const int INFI = 1e9;
const long long INFIL = 1e17;
const int N = 1111111;
const int M = 5555;
const int move[8][2] = {1, 0, -1, 0, 0, 1, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1};
int a[M], cnt[N], n, k;
bool vis[N];
int abs(int x) { return x > 0 ? x : -x; }
bool check(int x) {
  int sum = 0, t;
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    t = a[i] % x;
    if (!vis[t])
      vis[t] = 1;
    else
      sum++;
  }
  return sum <= k;
}
int main() {
  int m, sum, t;
  while (scanf("%d%d", &n, &k) != EOF) {
    memset(cnt, 0, sizeof(cnt));
    m = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      m = max(m, a[i]);
      for (int j = 0; j < i; j++) cnt[abs(a[i] - a[j])]++;
    }
    m++;
    t = k * (k + 1) / 2;
    for (int i = 1; i < m; i++) {
      sum = 0;
      for (int j = i; j < m; j += i) {
        sum += cnt[j];
        if (sum > t) break;
      }
      if (sum <= t && check(i)) {
        printf("%d\n", i);
        break;
      }
    }
  }
  return 0;
}

```