#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int nums[n];
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    cin >> nums[i];
    if (nums[i] > maxi) {
      maxi = nums[i];
    }
  }
  int diffs[maxi + 1];
  int mo[maxi + 1];
  for (int i = 0; i <= maxi; i++) {
    diffs[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      diffs[abs(nums[i] - nums[j])]++;
    }
  }
  for (int i = 0; i <= maxi; i++) {
    mo[i] = 0;
  }
  int cnt;
  int ans;
  int cnt2;
  for (int i = 1; i <= maxi; i++) {
    cnt = 0;
    for (int j = i; j <= maxi; j = j + i) {
      cnt = cnt + diffs[j];
    }
    if (cnt > k * (k + 1) / 2) {
      continue;
    }
    cnt2 = 0;
    for (int j = 0; j < n; j++) {
      if (mo[nums[j] % i] == i) cnt2++;
      mo[nums[j] % i] = i;
    }
    if (cnt2 <= k) {
      cout << i;
      return 0;
    }
  }
}

### Prompt

Construct a CPP code solution to the problem outlined:

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 main() {
  int n, k;
  cin >> n >> k;
  int nums[n];
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    cin >> nums[i];
    if (nums[i] > maxi) {
      maxi = nums[i];
    }
  }
  int diffs[maxi + 1];
  int mo[maxi + 1];
  for (int i = 0; i <= maxi; i++) {
    diffs[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      diffs[abs(nums[i] - nums[j])]++;
    }
  }
  for (int i = 0; i <= maxi; i++) {
    mo[i] = 0;
  }
  int cnt;
  int ans;
  int cnt2;
  for (int i = 1; i <= maxi; i++) {
    cnt = 0;
    for (int j = i; j <= maxi; j = j + i) {
      cnt = cnt + diffs[j];
    }
    if (cnt > k * (k + 1) / 2) {
      continue;
    }
    cnt2 = 0;
    for (int j = 0; j < n; j++) {
      if (mo[nums[j] % i] == i) cnt2++;
      mo[nums[j] % i] = i;
    }
    if (cnt2 <= k) {
      cout << i;
      return 0;
    }
  }
}

```