#include <bits/stdc++.h>
using namespace std;
pair<int, int> vec[1000005][5];
int in[1000005], sz[1000005];
bool ng[1000005], use[5005], ok[1000005];
int id[5005], md[5005];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int mx = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &in[i]);
    mx = max(mx, in[i]);
  }
  mx++;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int d = abs(in[i] - in[j]);
      if (!ng[d]) {
        vec[d][sz[d]++] = pair<int, int>(i, j);
        if (sz[d] > m) {
          ng[d] = true;
          sz[d] = 0;
        }
      }
    }
  }
  for (int i = 1; i <= mx; i++) {
    bool up = true;
    int cnt = 0;
    int si = 0, sm = 0;
    for (int j = i; j <= mx; j += i) {
      for (int k = 0; k < sz[j]; k++) {
        pair<int, int> p = vec[j][k];
        if (!use[p.first]) {
          id[si++] = p.first;
          int l = in[p.first];
          use[p.first] = true;
          if (!ok[l % i]) {
            ok[l % i] = true;
            md[sm++] = l % i;
          } else
            cnt++;
        }
        if (!use[p.second]) {
          id[si++] = p.second;
          use[p.second] = true;
          cnt++;
        }
      }
      if (ng[j] || cnt > m) {
        up = false;
        break;
      }
    }
    for (int j = 0; j < si; j++) use[id[j]] = false;
    for (int j = 0; j < sm; j++) ok[md[j]] = false;
    if (up) {
      printf("%d\n", i);
      return 0;
    }
  }
  return 0;
}

### Prompt

Create a solution in cpp for 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;
pair<int, int> vec[1000005][5];
int in[1000005], sz[1000005];
bool ng[1000005], use[5005], ok[1000005];
int id[5005], md[5005];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int mx = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &in[i]);
    mx = max(mx, in[i]);
  }
  mx++;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int d = abs(in[i] - in[j]);
      if (!ng[d]) {
        vec[d][sz[d]++] = pair<int, int>(i, j);
        if (sz[d] > m) {
          ng[d] = true;
          sz[d] = 0;
        }
      }
    }
  }
  for (int i = 1; i <= mx; i++) {
    bool up = true;
    int cnt = 0;
    int si = 0, sm = 0;
    for (int j = i; j <= mx; j += i) {
      for (int k = 0; k < sz[j]; k++) {
        pair<int, int> p = vec[j][k];
        if (!use[p.first]) {
          id[si++] = p.first;
          int l = in[p.first];
          use[p.first] = true;
          if (!ok[l % i]) {
            ok[l % i] = true;
            md[sm++] = l % i;
          } else
            cnt++;
        }
        if (!use[p.second]) {
          id[si++] = p.second;
          use[p.second] = true;
          cnt++;
        }
      }
      if (ng[j] || cnt > m) {
        up = false;
        break;
      }
    }
    for (int j = 0; j < si; j++) use[id[j]] = false;
    for (int j = 0; j < sm; j++) ok[md[j]] = false;
    if (up) {
      printf("%d\n", i);
      return 0;
    }
  }
  return 0;
}

```