#include <bits/stdc++.h>
int main() {
  int n, h, i, j, s, ans = 0, ruiseki = 0, tmp, max = 0;
  scanf("%d %d", &n, &h);
  int a[n], b[n];
  for (i = 0; i <= n - 1; i++) {
    scanf("%d %d", &a[i], &b[i]);
  }
  for (i = 0; i <= n - 1; i++) {
    if (max <= a[i]) {
      max = a[i];
    }
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (b[i] < b[j]) {
        tmp = b[i];
        b[i] = b[j];
        b[j] = tmp;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
