#include <bits/stdc++.h>
const int LF = 1000005;
using namespace std;
int N, K;
int a[10000], L[1000010][2];
int num[1000010][10], mod[1000010][5];
void addNum(int k, int t) {
  if (L[k][0] - L[k][1] > K) return;
  int i;
  for (i = 0; i < L[k][0]; ++i)
    if (num[k][i] == t) break;
  if (i == L[k][0]) num[k][L[k][0]++] = t;
}
void addMod(int k, int t) {
  if (L[k][0] - L[k][1] > K) return;
  int i;
  for (i = 0; i < L[k][1]; ++i)
    if (mod[k][i] == t) break;
  if (i == L[k][1]) mod[k][L[k][1]++] = t;
}
int main() {
  int i, j, k, t;
  int num2[10], mod2[5], x, y;
  while (scanf("%d %d", &N, &K) != EOF) {
    for (i = 0; i < N; ++i) scanf("%d", &a[i]);
    memset(L, 0, sizeof(L));
    for (i = 0; i < N; ++i)
      for (j = i + 1; j < N; ++j) {
        k = abs(a[i] - a[j]);
        addMod(k, a[i] % k);
        addNum(k, a[i]);
        addNum(k, a[j]);
      }
    for (i = 1; i <= 1000000; ++i) {
      x = y = 0;
      for (j = i; j <= 1000000; j += i)
        if (L[j][0]) {
          for (k = 0; x - y <= K && k < L[j][1]; ++k) {
            for (t = 0; t < y; ++t)
              if (mod2[t] == mod[j][k] % i) break;
            if (t == y) mod2[y++] = mod[j][k] % i;
          }
          for (k = 0; x - y <= K && k < L[j][0]; ++k) {
            for (t = 0; t < x; ++t)
              if (num2[t] == num[j][k]) break;
            if (t == x) num2[x++] = num[j][k];
          }
          if (x - y > K) break;
        }
      if (x - y <= K) {
        printf("%d\n", i);
        break;
      }
    }
  }
  return 0;
}

### Prompt

Please formulate 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>
const int LF = 1000005;
using namespace std;
int N, K;
int a[10000], L[1000010][2];
int num[1000010][10], mod[1000010][5];
void addNum(int k, int t) {
  if (L[k][0] - L[k][1] > K) return;
  int i;
  for (i = 0; i < L[k][0]; ++i)
    if (num[k][i] == t) break;
  if (i == L[k][0]) num[k][L[k][0]++] = t;
}
void addMod(int k, int t) {
  if (L[k][0] - L[k][1] > K) return;
  int i;
  for (i = 0; i < L[k][1]; ++i)
    if (mod[k][i] == t) break;
  if (i == L[k][1]) mod[k][L[k][1]++] = t;
}
int main() {
  int i, j, k, t;
  int num2[10], mod2[5], x, y;
  while (scanf("%d %d", &N, &K) != EOF) {
    for (i = 0; i < N; ++i) scanf("%d", &a[i]);
    memset(L, 0, sizeof(L));
    for (i = 0; i < N; ++i)
      for (j = i + 1; j < N; ++j) {
        k = abs(a[i] - a[j]);
        addMod(k, a[i] % k);
        addNum(k, a[i]);
        addNum(k, a[j]);
      }
    for (i = 1; i <= 1000000; ++i) {
      x = y = 0;
      for (j = i; j <= 1000000; j += i)
        if (L[j][0]) {
          for (k = 0; x - y <= K && k < L[j][1]; ++k) {
            for (t = 0; t < y; ++t)
              if (mod2[t] == mod[j][k] % i) break;
            if (t == y) mod2[y++] = mod[j][k] % i;
          }
          for (k = 0; x - y <= K && k < L[j][0]; ++k) {
            for (t = 0; t < x; ++t)
              if (num2[t] == num[j][k]) break;
            if (t == x) num2[x++] = num[j][k];
          }
          if (x - y > K) break;
        }
      if (x - y <= K) {
        printf("%d\n", i);
        break;
      }
    }
  }
  return 0;
}

```