#include <bits/stdc++.h>
using namespace std;
const int N = 5005, M = 1e6 + 10;
int n, k;
int a[N], dis[M];
int vis[M];
bool check(int val) {
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    int dex = a[i] % val;
    vis[dex]++;
  }
  int sum = 0;
  for (int i = 0; i < val; i++) {
    if (vis[i] > 1) {
      sum += vis[i] - 1;
      if (sum > k) return 0;
    }
  }
  return 1;
}
int main() {
  while (cin >> n >> k) {
    int Max = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      Max = max(Max, a[i]);
    }
    sort(a, a + n);
    memset(dis, 0, sizeof(dis));
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        int dex = a[j] - a[i];
        dis[dex]++;
      }
    }
    int ans = 0;
    for (int i = 1; i <= Max + 1; i++) {
      int sum = 0;
      bool OK = 1;
      for (int j = i; j <= Max; j += i) {
        sum += dis[j];
        if (sum > k * (k + 1) / 2) {
          OK = 0;
          break;
        }
      }
      if (OK && check(i)) {
        ans = i;
        break;
      }
    }
    printf("%d\n", ans);
  }
  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;
const int N = 5005, M = 1e6 + 10;
int n, k;
int a[N], dis[M];
int vis[M];
bool check(int val) {
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    int dex = a[i] % val;
    vis[dex]++;
  }
  int sum = 0;
  for (int i = 0; i < val; i++) {
    if (vis[i] > 1) {
      sum += vis[i] - 1;
      if (sum > k) return 0;
    }
  }
  return 1;
}
int main() {
  while (cin >> n >> k) {
    int Max = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      Max = max(Max, a[i]);
    }
    sort(a, a + n);
    memset(dis, 0, sizeof(dis));
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        int dex = a[j] - a[i];
        dis[dex]++;
      }
    }
    int ans = 0;
    for (int i = 1; i <= Max + 1; i++) {
      int sum = 0;
      bool OK = 1;
      for (int j = i; j <= Max; j += i) {
        sum += dis[j];
        if (sum > k * (k + 1) / 2) {
          OK = 0;
          break;
        }
      }
      if (OK && check(i)) {
        ans = i;
        break;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

```