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.
#include <bits/stdc++.h>
using namespace std;
int n, d;
struct Node {
  int mx, ad;
} seg[200010 * 12];
pair<int, int> inp[200010];
map<int, int> dis;
int inv[200010 * 4];
int cn = 0;
int cmi = 0;
int lav = -1;
int cl = 0;
void assignV(int ed) {
  typeof(dis.begin()) it = dis.upper_bound(lav);
  for (; it != dis.end() && it->first <= ed; ++it) {
    inv[cn] = it->first;
    it->second = cn++;
  }
  lav = ed;
}
void s_add(int i, int l, int r, int st, int ed, int av) {
  if (ed <= st) return;
  if (st == l && ed == r) {
    seg[i].mx += av;
    seg[i].ad += av;
    return;
  }
  int m = (l + r) / 2;
  if (m <= st)
    s_add(i * 2 + 2, m, r, st, ed, av);
  else if (m >= ed)
    s_add(i * 2 + 1, l, m, st, ed, av);
  else {
    s_add(i * 2 + 1, l, m, st, m, av);
    s_add(i * 2 + 2, m, r, m, ed, av);
  }
  seg[i].mx = max(seg[2 * i + 1].mx, seg[2 * i + 2].mx) + seg[i].ad;
}
int s_getMinId(int i, int l, int r, int av, int cv) {
  if (seg[i].mx + av < cv) return r;
  if (l + 1 == r) return l;
  int m = (l + r) / 2;
  if (seg[2 * i + 1].mx + av + seg[i].ad >= cv)
    return s_getMinId(i * 2 + 1, l, m, av + seg[i].ad, cv);
  else
    return s_getMinId(i * 2 + 2, m, r, av + seg[i].ad, cv);
}
void lemon() {
  scanf("%d%d", &n, &d);
  for (int i = (0); i <= (n - 1); i++) {
    int s, t;
    scanf("%d%d", &s, &t);
    if (t < 0)
      i--, n--;
    else {
      s = max(s, 0);
      inp[i] = pair<int, int>(t + 1, s);
      dis[s] = 0, dis[t + 1] = 0;
    }
  }
  sort(inp, inp + n);
  int maxd = n * 3 + 1;
  inv[maxd] = 1000000001;
  for (int i = (0); i <= (n - 1); i++) {
    int np = inv[s_getMinId(0, 0, maxd, 0, cmi + 1)];
    np += d;
    if (np < cl) np = cl;
    if (np <= inp[i].first) {
      cmi++;
      if (dis.find(np) == dis.end()) dis[np] = 0;
      assignV(np);
      s_add(0, 0, maxd, dis[np], maxd, 1);
      cl = np;
      i--;
    } else {
      assignV(inp[i].first);
      s_add(0, 0, maxd, dis[inp[i].second], dis[inp[i].first], 1);
      cl = inp[i].first;
    }
  }
  printf("%d\n", seg[0].mx);
}
int main() {
  ios::sync_with_stdio(true);
  lemon();
  return 0;
}
