#include <bits/stdc++.h>
using namespace std;
struct node {
  long long a;
  long long b;
};
long long sum = 0, Max = 0;
int main() {
  int N, H;
  cin >> N >> H;
  struct node ka[100005];
  for (int i = 0; i < N; i++) {
    cin >> ka[i].a >> ka[i].b;
    Max = Max + ka[i].b;
  }
  if (Max >= H) {
    cout << N << endl;
  } else if (Max < H) {
  }
  return 0;
}
