Problem: A duck hunter is doing his favorite thing, hunting. He lives in a two dimensional world and is located at point (0, 0). As he doesn't like walking for his prey, he prefers to shoot only vertically up (because in this case, the ducks fall straight into his hands). The hunter doesn't reload the gun immediately — r or more seconds must pass between the shots. When the hunter shoots up, the bullet immediately hits all the ducks who are directly above the hunter.

In a two dimensional world each duck is a horizontal segment that moves horizontally in the negative direction of the Ox axis at the speed 1 length unit per second. For each duck we know the values hi and ti — the x-coordinates of its head (the left end of the segment) and its tail (the right end of the segment) at time 0. The height where the duck is flying isn't important as the gun shoots vertically up to the infinite height and hits all the ducks on its way. 

<image> The figure to the first sample.

What maximum number of ducks can the hunter shoot? The duck is considered shot by the hunter if at the moment of the shot at least one of its point intersects the Oy axis. After the hunter shoots the duck, it falls and it can't be shot anymore. The hunter cannot make shots before the moment of time 0.

Input

The first line of the input contains integers n, r (1 ≤ n ≤ 200 000, 1 ≤ r ≤ 109) — the number of ducks and the minimum time in seconds between the shots. 

Then n lines follow, each of them contains two integers hi, ti ( - 109 ≤ hi < ti ≤ 109) — the x-coordinate of the head and tail of the i-th duck at the moment 0.

Output

Print a single integer — the maximum number of ducks that can be shot by the hunter.

Examples

Input

3 3
-3 0
1 3
-1 2


Output

3


Input

4 5
-1 1
2 4
5 9
6 8


Output

3

Note

In the first sample the hunter must shoot at time 0, this shot kills ducks 1 and 3. Then the hunter needs to reload the gun and shoot again at time 3. His second shot hits the tail of duck 2.

In the second sample the hunter can make shots at times 0 and 6 to hit three ducks.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, k;
priority_queue<pair<int, int> > H;
struct node {
  int sum, mx;
  node *c[2];
  node() { c[0] = c[1] = NULL, sum = mx = 0; }
} *rt = new node;
int getMax(node *x, int s, int t, int l = 0, int r = (int)1e9) {
  if (!x || l >= t || r <= s) return 0;
  if (l >= s && r <= t) return x->mx;
  int mid = l + r >> 1;
  return x->sum +
         max(getMax(x->c[0], s, t, l, mid), getMax(x->c[1], s, t, mid, r));
}
void maintain(node *x) {
  x->mx =
      x->sum + max((x->c[0] ? x->c[0]->mx : 0), (x->c[1] ? x->c[1]->mx : 0));
}
void setValue(node *&x, int p, int d, int l = 0, int r = (int)1e9) {
  if (!x) x = new node;
  if (l + 1 == r)
    x->mx = x->sum = d;
  else {
    int mid = l + r >> 1;
    if (p < mid)
      setValue(x->c[0], p, d, l, mid);
    else
      setValue(x->c[1], p, d, mid, r);
    maintain(x);
  }
}
void insert(node *x, int s, int t, int l = 0, int r = (int)1e9) {
  if (!x || l >= t || r <= s) return;
  if (l >= s && r <= t)
    x->sum++, x->mx++;
  else {
    int mid = l + r >> 1;
    insert(x->c[0], s, t, l, mid);
    insert(x->c[1], s, t, mid, r);
    maintain(x);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (r < 0) continue;
    l = max(l, 0);
    H.push(make_pair(-r, -l));
    H.push(make_pair(-l, 2));
  }
  int pre = -1;
  while (!H.empty()) {
    int l = -H.top().second, r = -H.top().first;
    H.pop();
    if (l < 0) {
      if (r == pre) continue;
      int v = getMax(rt, 0, r - k + 1);
      if (l == -2 || v > getMax(rt, pre, pre + 1)) {
        setValue(rt, r, v);
        pre = r;
        if (r + k <= (int)1e9) H.push(make_pair(-(r + k), 1));
      }
    } else
      insert(rt, l, r + 1);
  }
  printf("%d\n", rt->mx);
  fclose(stdin);
  fclose(stdout);
  return 0;
}