#include <bits/stdc++.h>
int abs(int x) { return (x < 0) ? -x : x; }
int main(void) {
  int n, k;
  int a[5000];
  int diff[1000000 + 1] = {};
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; j < i; j++) diff[abs(a[i] - a[j])]++;
  }
  int mark[5000] = {};
  for (int i = std::max(n - k, 1); i <= 1000000 + 1; i++) {
    int excess = 0;
    for (int j = i; j <= 1000000; j += i) {
      excess += diff[j];
      if (excess > k * (k + 1) / 2) break;
    }
    if (excess > k * (k + 1) / 2) continue;
    excess = 0;
    for (int j = 0; j < n; j++) {
      if (mark[a[j] % i] == i)
        excess++;
      else
        mark[a[j] % i] = i;
    }
    if (excess <= k) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}

### Prompt

Please create a solution in cpp 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>
int abs(int x) { return (x < 0) ? -x : x; }
int main(void) {
  int n, k;
  int a[5000];
  int diff[1000000 + 1] = {};
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; j < i; j++) diff[abs(a[i] - a[j])]++;
  }
  int mark[5000] = {};
  for (int i = std::max(n - k, 1); i <= 1000000 + 1; i++) {
    int excess = 0;
    for (int j = i; j <= 1000000; j += i) {
      excess += diff[j];
      if (excess > k * (k + 1) / 2) break;
    }
    if (excess > k * (k + 1) / 2) continue;
    excess = 0;
    for (int j = 0; j < n; j++) {
      if (mark[a[j] % i] == i)
        excess++;
      else
        mark[a[j] % i] = i;
    }
    if (excess <= k) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}

```