#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const int maxm = 256 + 10;
const int inf = 2e9 + 7;
const int mod = 1e9 + 7;
const double eps = 1e-9;
inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, k;
int dp[maxn], a[maxn];
bool check(int x) {
  int last = 0;
  for (int i = 1; i <= n; ++i) dp[i] = 0;
  for (int i = k; i <= n; ++i) {
    if (a[i] - a[dp[i - k] + 1] <= x) last = i;
    dp[i] = last;
  }
  return dp[n] == n;
}
int main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  if (k == 1) {
    puts("0");
    return 0;
  }
  sort(a + 1, a + n + 1);
  int l = a[k] - a[1], r = a[n] - a[1];
  while (l < r) {
    int mid = l + r >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%d\n", r);
}

### Prompt

Please create a solution in cpp to the following problem:

Evlampiy has found one more cool application to process photos. However the application has certain limitations.

Each photo i has a contrast vi. In order for the processing to be truly of high quality, the application must receive at least k photos with contrasts which differ as little as possible.

Evlampiy already knows the contrast vi for each of his n photos. Now he wants to split the photos into groups, so that each group contains at least k photos. As a result, each photo must belong to exactly one group.

He considers a processing time of the j-th group to be the difference between the maximum and minimum values of vi in the group. Because of multithreading the processing time of a division into groups is the maximum processing time among all groups.

Split n photos into groups in a such way that the processing time of the division is the minimum possible, i.e. that the the maximum processing time over all groups as least as possible.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 3·105) — number of photos and minimum size of a group.

The second line contains n integers v1, v2, ..., vn (1 ≤ vi ≤ 109), where vi is the contrast of the i-th photo.

Output

Print the minimal processing time of the division into groups.

Examples

Input

5 2
50 110 130 40 120


Output

20


Input

4 1
2 3 4 1


Output

0

Note

In the first example the photos should be split into 2 groups: [40, 50] and [110, 120, 130]. The processing time of the first group is 10, and the processing time of the second group is 20. Maximum among 10 and 20 is 20. It is impossible to split the photos into groups in a such way that the processing time of division is less than 20.

In the second example the photos should be split into four groups, each containing one photo. So the minimal possible processing time of a division is 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const int maxm = 256 + 10;
const int inf = 2e9 + 7;
const int mod = 1e9 + 7;
const double eps = 1e-9;
inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, k;
int dp[maxn], a[maxn];
bool check(int x) {
  int last = 0;
  for (int i = 1; i <= n; ++i) dp[i] = 0;
  for (int i = k; i <= n; ++i) {
    if (a[i] - a[dp[i - k] + 1] <= x) last = i;
    dp[i] = last;
  }
  return dp[n] == n;
}
int main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  if (k == 1) {
    puts("0");
    return 0;
  }
  sort(a + 1, a + n + 1);
  int l = a[k] - a[1], r = a[n] - a[1];
  while (l < r) {
    int mid = l + r >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%d\n", r);
}

```