#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int first[4 * maxn];
int temp[maxn];
int a[5005];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int u = a[j] - a[i];
      first[abs(u)]++;
    }
  }
  auto can = [&](int modd) {
    memset(temp, 0, sizeof(temp));
    int rem = 0;
    for (int i = 0; i < n; i++) {
      int xx = a[i] % modd;
      temp[xx]++;
      if (temp[xx] >= 2) rem++;
    }
    return rem <= k;
  };
  for (int i = 1; i <= maxn; i++) {
    int rem = 0;
    for (int j = i; j < maxn; j += i) rem += first[j];
    if (rem <= k) {
      printf("%d\n", i);
      return 0;
    } else if (2LL * rem > 1LL * k * (k + 1))
      continue;
    if (can(i)) {
      printf("%d\n", i);
      return 0;
    }
  }
}

### Prompt

In cpp, your task is to solve 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 maxn = 1e6 + 5;
int first[4 * maxn];
int temp[maxn];
int a[5005];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int u = a[j] - a[i];
      first[abs(u)]++;
    }
  }
  auto can = [&](int modd) {
    memset(temp, 0, sizeof(temp));
    int rem = 0;
    for (int i = 0; i < n; i++) {
      int xx = a[i] % modd;
      temp[xx]++;
      if (temp[xx] >= 2) rem++;
    }
    return rem <= k;
  };
  for (int i = 1; i <= maxn; i++) {
    int rem = 0;
    for (int j = i; j < maxn; j += i) rem += first[j];
    if (rem <= k) {
      printf("%d\n", i);
      return 0;
    } else if (2LL * rem > 1LL * k * (k + 1))
      continue;
    if (can(i)) {
      printf("%d\n", i);
      return 0;
    }
  }
}

```