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;
inline int read() {
  int x = 0, c = getchar(), f = 0;
  for (; c > '9' || c < '0'; f = c == '-', c = getchar())
    ;
  for (; c >= '0' && c <= '9'; x = (x << 1) + (x << 3) + c - '0', c = getchar())
    ;
  return f ? -x : x;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
}
const int N = 200000 + 10, oo = 2e9;
struct node {
  int h, t;
  bool operator<(const node &B) const {
    return t < B.t || (t == B.t && h < B.h);
  }
} a[N];
int Ql, Qr, Qv, tag[N * 12], mn[N * 12];
void down(int o) {
  int &x = tag[o];
  if (x) {
    tag[o << 1] += x, tag[o << 1 | 1] += x;
    mn[o << 1] += x, mn[o << 1 | 1] += x;
    x = 0;
  }
}
void modify(int o, int l, int r) {
  if (Ql > Qr) return;
  if (Ql <= l && Qr >= r) {
    tag[o] += Qv, mn[o] += Qv;
    return;
  }
  down(o);
  if (Ql <= ((l + r) >> 1)) modify(o << 1, l, ((l + r) >> 1));
  if (Qr > ((l + r) >> 1)) modify(o << 1 | 1, ((l + r) >> 1) + 1, r);
  mn[o] = min(mn[o << 1], mn[o << 1 | 1]);
}
int query(int o, int l, int r) {
  if (Ql > Qr) return oo;
  if (Ql <= l && Qr >= r) return mn[o];
  down(o);
  if (Ql > ((l + r) >> 1)) return query(o << 1 | 1, ((l + r) >> 1) + 1, r);
  if (Qr <= ((l + r) >> 1)) return query(o << 1, l, ((l + r) >> 1));
  return min(query(o << 1, l, ((l + r) >> 1)),
             query(o << 1 | 1, ((l + r) >> 1) + 1, r));
}
map<int, int> id;
int n, r, nn, has[N * 2], dis[N * 3];
int main() {
  n = read(), r = read();
  for (int i = 1, _y = n; i <= _y; ++i) {
    int h = read(), t = read();
    if (t < 0) continue;
    if (h < 0) h = 0;
    a[++nn] = (node){h, t};
    has[++*has] = h, has[++*has] = t + 1;
  }
  n = nn;
  sort(a + 1, a + n + 1);
  sort(has + 1, has + *has + 1);
  *has = unique(has + 1, has + *has + 1) - (has + 1);
  has[*has + 1] = oo;
  nn = 3 * n + 1;
  dis[nn + 1] = oo;
  for (int p = -oo, i = 1, j = 0, k = 1, l = 0; p < oo;) {
    for (; i <= n && a[i].t < p; ++i)
      Ql = 1, Qr = id[a[i].h], Qv = 1, modify(1, 1, nn);
    dis[j] = p, id[p] = j++;
    if (j > 1) {
      int nv, pv;
      Ql = 1, Qr = id.upper_bound(p - r)->second, nv = query(1, 1, nn);
      Ql = j - 1, Qr = j - 1, pv = query(1, 1, nn);
      if (nv != pv) Ql = j, Qr = nn, Qv = nv - pv, modify(1, 1, nn);
    }
    for (; k <= *has && has[k] <= p; ++k)
      ;
    for (; dis[l] + r <= p; ++l)
      ;
    p = has[k];
    for (; l < j && dis[l] + r < has[k]; ++l)
      if (l > 0) {
        int nv, pv;
        Ql = 1, Qr = l, nv = query(1, 1, nn);
        Ql = l + 1, Qr = l + 1, pv = query(1, 1, nn);
        if (nv > pv) {
          p = dis[l] + r;
          break;
        }
      }
  }
  printf("%d\n", n - mn[1]);
}