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;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 200000, max0 = 100000, maxabs = 1e9;
struct node;
node *newnode();
struct node {
  node *c[2];
  int Max;
  int label;
  node() : Max(0), label(0) { memset(c, 0, sizeof c); }
  void update() {
    Max = 0;
    for (int i = (0), _end_ = (2); i < _end_; ++i)
      if (c[i]) chkmax(Max, c[i]->Max);
  }
  void flag_label(int _label) {
    label += _label;
    Max += _label;
  }
  void push_down() {
    if (label) {
      for (int i = (0), _end_ = (2); i < _end_; ++i) {
        if (!c[i]) c[i] = newnode();
        c[i]->flag_label(label);
      }
      label = 0;
    }
  }
  inline int get_Max() { return this ? Max : 0; }
};
node *nd_pool;
int nd_res = 0;
node *newnode() {
  if (!nd_res) nd_pool = new node[max0], nd_res = max0;
  return nd_pool + (--nd_res);
}
node *rt;
int seg_x, seg_y, seg_z;
void add(node *&rt, int l, int r) {
  if (!rt) rt = newnode();
  if (seg_x <= l && r <= seg_y) {
    rt->flag_label(seg_z);
    return;
  }
  int mid = (l + r) >> 1;
  rt->push_down();
  if (seg_x < mid) add(rt->c[0], l, mid);
  if (seg_y > mid) add(rt->c[1], mid, r);
  rt->update();
}
inline bool seg_add(int first, int second, int z) {
  if (first >= second) return 0;
  seg_x = first, seg_y = second, seg_z = z;
  add(rt, 0, maxabs + 1);
  return 1;
}
inline void find(node *rt, int l, int r) {
  assert(rt);
  if (r - l <= 1) {
    seg_y = l;
    return;
  }
  rt->push_down();
  int mid = (l + r) >> 1;
  if (rt->c[0]->get_Max() >= seg_x)
    find(rt->c[0], l, mid);
  else
    find(rt->c[1], mid, r);
}
int n, d;
pair<int, int> a[maxn + 5];
inline bool cmp(const pair<int, int> &first, const pair<int, int> &second) {
  return first.second < second.second;
}
inline int find(int first) {
  if (first > rt->get_Max()) return oo;
  seg_x = first;
  seg_y = oo;
  find(rt, 0, maxabs + 1);
  return seg_y;
}
int main() {
  scanf("%d%d", &n, &d);
  for (int i = (0), _end_ = (n); i < _end_; ++i)
    scanf("%d%d", &a[i].first, &a[i].second), ++a[i].second,
        chkmax(a[i].first, 0), chkmax(a[i].second, 0);
  int now = 0;
  sort(a, a + n, cmp);
  int lst = 0;
  for (int i = (0), _end_ = (n); i < _end_; ++i) {
    seg_add(lst, a[i].second, now);
    int tmp = -1;
    while ((tmp = find(now + 1) + d) < a[i].second) {
      ++now;
      chkmax(tmp, lst);
      seg_add(tmp, a[i].second, 1);
    }
    seg_add(a[i].first, a[i].second, 1);
    chkmax(lst, a[i].second);
  }
  printf("%d\n", rt->get_Max());
  return 0;
}