#include <bits/stdc++.h>
using namespace std;
struct KATANA {
  int a;
  int b;
  bool no;
} k[100000];
int bl, n, ki;
bool cmp(KATANA a, KATANA b) { return a.b > b.b; }
int main() {
  cin >> n >> bl;
  int max[2] = {0, 0};
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    k[i].a = t;
    if (t > max[0]) {
      max[0] = t;
      max[1] = i;
    }
    cin >> t;
    k[i].b = t;
  }
  k[max[1]].no = 1;
  sort(k, k + n, cmp);
  for (int i = 0; i < n; i++) {
    if (k[i].no == 0)
      bl -= k[i].b;
    else
      max[1] = i;
    if (bl <= 0) {
      cout << i + 1;
      return 0;
    }
    ki = i;
  }
  while (bl > 0) {
    bl -= k[max[1]].a;
    ki++;
  }
  cout << ki - 1;
  return 0;
}
