You are given a permutation P_1 ... P_N of the set {1, 2, ..., N}.

You can apply the following operation to this permutation, any number of times (possibly zero):

* Choose two indices i,j (1 ≦ i < j ≦ N), such that j - i ≧ K and |P_i - P_j| = 1. Then, swap the values of P_i and P_j.



Among all permutations that can be obtained by applying this operation to the given permutation, find the lexicographically smallest one.

Constraints

* 2≦N≦500,000
* 1≦K≦N-1
* P is a permutation of the set {1, 2, ..., N}.

Input

The input is given from Standard Input in the following format:


N K
P_1 P_2 ... P_N


Output

Print the lexicographically smallest permutation that can be obtained.

Examples

Input

4 2
4 2 3 1


Output

2
1
4
3


Input

5 1
5 4 3 2 1


Output

1
2
3
4
5


Input

8 3
4 5 7 8 3 1 2 6


Output

1
2
6
7
5
3
4
8
#include <bits/stdc++.h>
const long long maxn = 4e3 + 20, delta = 2005;
inline long long Max(long long a, long long b) { return a > b ? a : b; }
inline long long Min(long long a, long long b) { return a > b ? b : a; }
namespace FastIO {
inline long long read() {
  long long f = 1, r = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (isdigit(c)) {
    r = 10 * r + c - '0';
    c = getchar();
  }
  return f * r;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writesp(long long x) { write(x), putchar(' '); }
inline void writeln(long long x) { write(x), puts(""); }
};  // namespace FastIO
using namespace FastIO;
long long fac[maxn * 2], N, arr[maxn][2], dp[maxn * 2][maxn * 2],
    invv[maxn * 2];
inline long long exgcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  long long d = exgcd(b, a % b, x, y);
  long long tmp = y;
  y = x - a / b * y;
  x = tmp;
  return d;
}
inline long long inv(long long a, long long b) {
  long long x, y;
  exgcd(a, b, x, y);
  return (x + 1000000007) % 1000000007;
}
signed main() {
  N = read();
  for (register long long i = 1; i <= N; ++i) {
    arr[i][0] = read(), arr[i][1] = read(),
    dp[-arr[i][0] + delta][-arr[i][1] + delta]++;
  }
  for (register long long i = -2000 + delta; i <= 2000 + delta; ++i) {
    for (register long long j = -2000 + delta; j <= 2000 + delta; ++j) {
      dp[i][j] = (dp[i - 1][j] + dp[i][j] + dp[i][j - 1]) % 1000000007;
    }
  }
  fac[0] = 1;
  for (register long long i = 1; i < maxn * 2; ++i) {
    fac[i] = fac[i - 1] * i % 1000000007;
  }
  for (register long long i = 0; i < maxn * 2; ++i) {
    invv[i] = inv(fac[i], 1000000007);
  }
  long long ans = 0;
  for (register long long i = 1; i <= N; ++i) {
    long long down = 2 * (arr[i][0] + arr[i][1]), up = 2 * arr[i][0];
    long long tmp =
        fac[down] * invv[down - up] % 1000000007 * invv[up] % 1000000007;
    ans = (ans + tmp) % 1000000007;
  }
  long long sum = 0;
  for (register long long i = 1; i <= N; ++i) {
    sum = (sum + dp[arr[i][0] + delta][arr[i][1] + delta]) % 1000000007;
  }
  sum = (sum - ans + 1000000007) % 1000000007;
  sum = (sum * inv(2, 1000000007)) % 1000000007;
  writeln(sum);
  return 0;
}
