#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, sum = 0, jjj;
  cin >> a >> b;
  int c[101010], d[101010];
  for (int i = 0; i < a; i++) {
    cin >> c[i] >> d[i];
    sum += d[i];
  }
  jjj = a;
  if (sum >= b) {
    sort(d, d + a);
    for (int i = 0; i < a; i++) {
      sum -= d[i];
      jjj--;
      if (sum < b) {
        cout << jjj + 1;
        system("pause");
        return 0;
      }
    }
  } else {
    sort(c, c + a);
    reverse(c, c + a);
    while (sum < b) {
      sum += c[1];
      jjj++;
    }
    cout << jjj + 1;
  }
  system("pause");
  return 0;
}
