#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[1000000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
int read() {
  int pos = 1, num = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') pos = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    num = num * 10 + (int)(ch - '0');
    ch = getchar();
  }
  return pos * num;
}
void write(int x) {
  if (x < 0) {
    putchar('-');
    write(-x);
    return;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writesp(int x) {
  write(x);
  putchar(' ');
}
void writeln(int x) {
  write(x);
  putchar('\n');
}
const int N = 1e6 + 10;
struct node {
  int x, y;
} a[N];
int n, d, ans;
bool cmp(node x, node y) {
  return max(x.x, x.y) < max(y.x, y.y) ||
         max(x.x, x.y) == max(y.x, y.y) && x.x < y.x;
}
signed main() {
  n = read();
  d = read();
  for (int i = 1; i <= n; i++) a[i].x = read(), a[i].y = read();
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    if (a[i].x >= d) ans++, d = max(d, a[i].y);
  writeln(ans);
}
