#include <bits/stdc++.h>
using namespace std;
int s[5010];
int n, k;
short mp[1400010];
bool used[1000010];
bool usedDiv[1000010];
void solve() {
  if (k >= 1) {
    for (int put = 1; put < 1400000; ++put) {
      bool good = true;
      memset(mp, 0, (put * 2) + 10);
      int remove = 0;
      for (int i = 0; i < n; ++i) {
        int mod = s[i] % put;
        ++mp[mod];
        if (mp[mod] > 1) ++remove;
        if (remove > k) {
          good = false;
          break;
        }
      }
      if (good) {
        cout << put << endl;
        break;
      }
      if (put % 1000 == 0) {
        cerr << "put = " << put << endl;
      }
    }
  } else {
    memset(used, 0, sizeof used);
    memset(usedDiv, 0, sizeof usedDiv);
    for (int i = 0; i < n; i++)
      for (int u = i + 1; u < n; ++u) used[abs(s[u] - s[i])] = true;
    for (int i = 1; i <= 1000000; ++i) {
      for (int u = i; u <= 1000000; u += i) {
        if (used[u]) {
          usedDiv[i] = true;
          break;
        }
      }
    }
    for (int put = 1;; ++put) {
      if (!usedDiv[put]) {
        cout << put << endl;
        break;
      }
    }
  }
}
int conf[1000010][5];
int len[1000010];
int mark[1000010];
void solve2() {
  sort(s, s + n);
  for (int i = 0; i < n; ++i) {
    for (int u = i + 1; u < n; ++u) {
      const int diff = s[u] - s[i];
      if (len[diff] < 5) conf[diff][len[diff]++] = s[u];
    }
  }
  cerr << "sizes time" << double(clock()) / CLOCKS_PER_SEC << endl;
  for (int put = 1;; ++put) {
    bool good = true;
    int ec = 0;
    int remove = 0;
    for (int u = put; remove <= k && u < 1000001; u += put) {
      for (int i = 0; i < len[u]; ++i) {
        remove += mark[conf[u][i]] != put;
        mark[conf[u][i]] = put;
      }
    }
    if (remove <= k) {
      cout << put << endl;
      break;
    }
  }
}
int nextRand() { return (rand() | (rand() << 10)) % 1000001; }
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> s[i];
  solve2();
  cerr << "time = " << double(clock()) / CLOCKS_PER_SEC << endl;
  return 0;
}

### Prompt

Your task is to create 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 s[5010];
int n, k;
short mp[1400010];
bool used[1000010];
bool usedDiv[1000010];
void solve() {
  if (k >= 1) {
    for (int put = 1; put < 1400000; ++put) {
      bool good = true;
      memset(mp, 0, (put * 2) + 10);
      int remove = 0;
      for (int i = 0; i < n; ++i) {
        int mod = s[i] % put;
        ++mp[mod];
        if (mp[mod] > 1) ++remove;
        if (remove > k) {
          good = false;
          break;
        }
      }
      if (good) {
        cout << put << endl;
        break;
      }
      if (put % 1000 == 0) {
        cerr << "put = " << put << endl;
      }
    }
  } else {
    memset(used, 0, sizeof used);
    memset(usedDiv, 0, sizeof usedDiv);
    for (int i = 0; i < n; i++)
      for (int u = i + 1; u < n; ++u) used[abs(s[u] - s[i])] = true;
    for (int i = 1; i <= 1000000; ++i) {
      for (int u = i; u <= 1000000; u += i) {
        if (used[u]) {
          usedDiv[i] = true;
          break;
        }
      }
    }
    for (int put = 1;; ++put) {
      if (!usedDiv[put]) {
        cout << put << endl;
        break;
      }
    }
  }
}
int conf[1000010][5];
int len[1000010];
int mark[1000010];
void solve2() {
  sort(s, s + n);
  for (int i = 0; i < n; ++i) {
    for (int u = i + 1; u < n; ++u) {
      const int diff = s[u] - s[i];
      if (len[diff] < 5) conf[diff][len[diff]++] = s[u];
    }
  }
  cerr << "sizes time" << double(clock()) / CLOCKS_PER_SEC << endl;
  for (int put = 1;; ++put) {
    bool good = true;
    int ec = 0;
    int remove = 0;
    for (int u = put; remove <= k && u < 1000001; u += put) {
      for (int i = 0; i < len[u]; ++i) {
        remove += mark[conf[u][i]] != put;
        mark[conf[u][i]] = put;
      }
    }
    if (remove <= k) {
      cout << put << endl;
      break;
    }
  }
}
int nextRand() { return (rand() | (rand() << 10)) % 1000001; }
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> s[i];
  solve2();
  cerr << "time = " << double(clock()) / CLOCKS_PER_SEC << endl;
  return 0;
}

```