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, v0, f[200012], nu = 0;
struct eve {
  int x, v, l;
  inline bool operator<(const eve &b) const {
    return (x < b.x) || ((x == b.x) && (v < b.v));
  }
};
multiset<eve> s;
inline void cha(int x, int v) {
  f[x] = v;
  if (v + v0 <= 1e9) s.insert((eve){v + v0, 0, -1});
}
int d[200012 << 2], ma[200012 << 2];
inline void Add(int p, int v) {
  d[p] += v;
  ma[p] += v;
}
inline void pd(int x) {
  if (d[x]) {
    Add(x << 1, d[x]);
    Add(x << 1 | 1, d[x]);
    d[x] = 0;
  }
}
void build(int p, int l, int r) {
  ma[p] = r;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
}
void change(int p, int l, int r, int L, int R, int v) {
  if ((R < l) || (r < L)) return;
  if ((L <= l) && (r <= R)) {
    Add(p, v);
    return;
  }
  pd(p);
  int mid = (l + r) >> 1;
  change(p << 1, l, mid, L, R, v);
  change(p << 1 | 1, mid + 1, r, L, R, v);
  ma[p] = max(ma[p << 1], ma[p << 1 | 1]);
}
int Ask(int p, int l, int r, int L, int R) {
  if ((R < l) || (r < L)) return 0;
  if ((L <= l) && (r <= R)) return ma[p];
  pd(p);
  int mid = (l + r) >> 1;
  return max(Ask(p << 1, l, mid, L, R), Ask(p << 1 | 1, mid + 1, r, L, R));
}
int main() {
  scanf("%d%d", &n, &v0);
  int i, l, r, x, o;
  eve p;
  memset(f, 0x3f, sizeof(f));
  build(1, 0, n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &l, &r);
    if (r < 0) continue;
    l = max(l, 0);
    s.insert((eve){l, 1, l});
    s.insert((eve){r + 1, -1, l});
  }
  cha(r = 0, -0x3f3f3f3f);
  while (!s.empty()) {
    p = *s.begin();
    nu += p.v;
    l = p.x;
    s.erase(s.begin());
    if (p.l >= 0) change(1, 0, n, lower_bound(f, f + n + 1, p.l) - f, n, -p.v);
    if ((!s.empty()) && ((s.begin()->x) == l)) continue;
    x = upper_bound(f, f + n + 1, l - v0) - f - 1;
    o = nu + Ask(1, 0, n, 0, x);
    while ((r < n) && (r < o)) cha(++r, l);
  }
  printf("%d", r);
  return 0;
}