#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[5009];
void ReadData() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
}
int answer;
int diff[1000009], bad[1000009];
void Solve() {
  memset(diff, 0, sizeof(diff));
  memset(bad, 0xFF, sizeof(bad));
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      diff[a[j] - a[i]]++;
    }
  }
  for (answer = 1; answer < a[n - 1] + 1; answer++) {
    int current = 0;
    for (int answerMul = answer; answerMul <= 1000000; answerMul += answer) {
      current += diff[answerMul];
    }
    if (current > (k * (k + 1)) / 2) {
      continue;
    }
    int cntToDel = 0;
    for (int i = 0; i < n; i++) {
      if (bad[a[i] % answer] == answer) {
        cntToDel++;
      } else {
        bad[a[i] % answer] = answer;
      }
    }
    if (cntToDel <= k) {
      break;
    }
  }
}
void WriteData() { printf("%d\n", answer); }
int main() {
  int QWE = 1;
  for (int T = 0; T < QWE; T++) {
    ReadData();
    Solve();
    WriteData();
  }
  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 n, k;
int a[5009];
void ReadData() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
}
int answer;
int diff[1000009], bad[1000009];
void Solve() {
  memset(diff, 0, sizeof(diff));
  memset(bad, 0xFF, sizeof(bad));
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      diff[a[j] - a[i]]++;
    }
  }
  for (answer = 1; answer < a[n - 1] + 1; answer++) {
    int current = 0;
    for (int answerMul = answer; answerMul <= 1000000; answerMul += answer) {
      current += diff[answerMul];
    }
    if (current > (k * (k + 1)) / 2) {
      continue;
    }
    int cntToDel = 0;
    for (int i = 0; i < n; i++) {
      if (bad[a[i] % answer] == answer) {
        cntToDel++;
      } else {
        bad[a[i] % answer] = answer;
      }
    }
    if (cntToDel <= k) {
      break;
    }
  }
}
void WriteData() { printf("%d\n", answer); }
int main() {
  int QWE = 1;
  for (int T = 0; T < QWE; T++) {
    ReadData();
    Solve();
    WriteData();
  }
  return 0;
}

```