#include <bits/stdc++.h>
using namespace std;
int a[5000 + 10], n, k, mx, cnt[1000000 + 10];
bool vis[1000000 + 10];
void Read(int &x) {
  char c;
  while (c = getchar(), c != EOF) {
    if (c >= '0' && c <= '9') {
      x = c - '0';
      while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
      ungetc(c, stdin);
      return;
    }
  }
}
int main() {
  Read(n), Read(k);
  for (int i = 1; i <= n; i++) {
    Read(a[i]);
    mx = max(mx, a[i]);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < i; j++) cnt[abs(a[i] - a[j])]++;
  for (int m = 1; m <= mx + 1; m++) {
    int sum = 0;
    for (int i = m; i <= mx; i += m) {
      sum += cnt[i];
      if (sum > k * (k + 1) / 2) break;
    }
    if (sum > k * (k + 1) / 2) continue;
    int p = 0;
    for (int i = 1; i <= n; i++) {
      if (!vis[a[i] % m])
        vis[a[i] % m] = true;
      else {
        p++;
        if (p > k) break;
      }
    }
    if (p <= k) {
      printf("%d\n", m);
      return 0;
    }
    for (int i = 1; i <= n; i++) vis[a[i] % m] = false;
  }
}

### Prompt

Your challenge is to write 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;
int a[5000 + 10], n, k, mx, cnt[1000000 + 10];
bool vis[1000000 + 10];
void Read(int &x) {
  char c;
  while (c = getchar(), c != EOF) {
    if (c >= '0' && c <= '9') {
      x = c - '0';
      while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
      ungetc(c, stdin);
      return;
    }
  }
}
int main() {
  Read(n), Read(k);
  for (int i = 1; i <= n; i++) {
    Read(a[i]);
    mx = max(mx, a[i]);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < i; j++) cnt[abs(a[i] - a[j])]++;
  for (int m = 1; m <= mx + 1; m++) {
    int sum = 0;
    for (int i = m; i <= mx; i += m) {
      sum += cnt[i];
      if (sum > k * (k + 1) / 2) break;
    }
    if (sum > k * (k + 1) / 2) continue;
    int p = 0;
    for (int i = 1; i <= n; i++) {
      if (!vis[a[i] % m])
        vis[a[i] % m] = true;
      else {
        p++;
        if (p > k) break;
      }
    }
    if (p <= k) {
      printf("%d\n", m);
      return 0;
    }
    for (int i = 1; i <= n; i++) vis[a[i] % m] = false;
  }
}

```