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;
const long long N = 6666666;
long long tree[N], upd[N];
long long leftind[N], rightind[N];
long long c = 1;
void push(long long v) {
  tree[v] = max(tree[leftind[v]], tree[rightind[v]]) + upd[v];
}
void update(long long &v, long long l, long long r, long long ind,
            long long val) {
  if (!v) {
    c++;
    v = c;
  }
  if (l == r) {
    tree[v] = upd[v] = val;
    return;
  }
  if (ind <= (r + l) / 2) {
    update(leftind[v], l, (r + l) / 2, ind, val);
  } else {
    update(rightind[v], (r + l) / 2 + 1, r, ind, val);
  }
  push(v);
}
void add(long long &v, long long l, long long r, long long al, long long ar) {
  if (!v) {
    return;
  }
  if (l >= al && r <= ar) {
    tree[v]++;
    upd[v]++;
    return;
  }
  if (l <= ar && r >= al) {
    add(leftind[v], l, (r + l) / 2, al, ar);
    add(rightind[v], (r + l) / 2 + 1, r, al, ar);
    push(v);
  }
}
long long ans(long long &v, long long l, long long r, long long al,
              long long ar) {
  if (!v) {
    return 0;
  }
  if (l >= al && r <= ar) {
    return tree[v];
  }
  if (l <= ar && r >= al) {
    return max(ans(leftind[v], l, (r + l) / 2, al, ar),
               ans(rightind[v], (r + l) / 2 + 1, r, al, ar)) +
           upd[v];
  }
  return 0;
}
signed main() {
  priority_queue<pair<long long, long long> > q;
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < N; i++) {
    leftind[i] = rightind[i] = tree[i] = upd[i] = 0;
  }
  for (long long i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    l = max(l, 0LL);
    q.push({-r, -l});
    q.push({-l, 1});
  }
  long long ind = -1;
  long long st = 1;
  while (!q.empty()) {
    long long l = -q.top().second;
    long long r = -q.top().first;
    q.pop();
    if (l >= 0) {
      add(st, 0, 1e9, l, r);
    } else {
      if (r == ind) {
        continue;
      }
      long long val1 = ans(st, 0, 1e9, ind, ind);
      long long val2 = ans(st, 0, 1e9, 0, r - k);
      if (l == -1 || val1 < val2) {
        ind = r;
        update(st, 0, 1e9, r, val2);
        if (r + k <= 1e9) {
          q.push({-r - k, 2});
        }
      }
    }
  }
  cout << tree[1];
  return 0;
}