#include <bits/stdc++.h>
using namespace std;
int MAX = (int)1e6;
int cnt[5 + (int)1e6], a[5000], n, k, lastSeen[5 + (int)1e6];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) cnt[a[j] - a[i]]++;
  for (int m = 1;; m++) {
    int num_of_pairs = 0;
    for (int j = m; j < MAX; j += m) {
      num_of_pairs += cnt[j];
    }
    if (num_of_pairs > k * (k + 1) / 2) {
      continue;
    }
    int num_to_remove = 0;
    for (int i = 0; i < n; i++) {
      int rem = a[i] % m;
      if (lastSeen[rem] == m) num_to_remove++;
      lastSeen[rem] = m;
    }
    if (num_to_remove <= k) {
      printf("%d\n", m);
      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;
int MAX = (int)1e6;
int cnt[5 + (int)1e6], a[5000], n, k, lastSeen[5 + (int)1e6];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) cnt[a[j] - a[i]]++;
  for (int m = 1;; m++) {
    int num_of_pairs = 0;
    for (int j = m; j < MAX; j += m) {
      num_of_pairs += cnt[j];
    }
    if (num_of_pairs > k * (k + 1) / 2) {
      continue;
    }
    int num_to_remove = 0;
    for (int i = 0; i < n; i++) {
      int rem = a[i] % m;
      if (lastSeen[rem] == m) num_to_remove++;
      lastSeen[rem] = m;
    }
    if (num_to_remove <= k) {
      printf("%d\n", m);
      return 0;
    }
  }
}

```