#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e16;
const int N = 4e5 + 50;
long long fac[N];
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long modinverse(long long a, long long m) { return binpow(a, m - 2, m); }
long long nck(long long n, long long r) {
  return ((fac[n] * modinverse(fac[r], 998244353)) % 998244353) *
         modinverse(fac[n - r], 998244353) % 998244353;
}
long long dp[101][30005];
vector<long long> a(101), b(101);
long long solve(long long idx, long long health, long long n,
                long long start_health, long long rem) {
  if (idx == n) {
    if (health + start_health >= 0) {
      return 0;
    } else {
      return INT_MIN;
    }
  }
  if (health + start_health < 0) return INT_MIN;
  long long new_health = health + rem;
  if (dp[idx][new_health] != -1) {
    return dp[idx][new_health];
  }
  long long ans = solve(idx + 1, health, n, start_health, rem);
  if (health + start_health >= a[idx] && health + start_health + b[idx] >= 0) {
    ans = max(ans, 1 + solve(idx + 1, health + b[idx], n, start_health, rem));
  }
  return dp[idx][new_health] = ans;
}
bool compare(pair<long long, long long> p1, pair<long long, long long> p2) {
  if (p1.second < 0 && p2.second >= 0) {
    return false;
  } else if (p1.second >= 0 && p2.second < 0) {
    return true;
  }
  if (p1.second < 0) {
    return (p1.second + p1.first) > (p2.second + p2.first);
  }
  if (p1.first == p2.first) {
    return p1.second > p2.second;
  }
  return (p1.first < p2.first);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long n;
  cin >> n;
  long long r;
  cin >> r;
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    cin >> b[i];
    v.push_back({a[i], b[i]});
  }
  sort(v.begin(), v.end(), compare);
  long long min_b = 0, max_b = 0;
  long long cur_sum = 0;
  for (long long i = 0; i < n; i++) {
    a[i] = v[i].first;
    b[i] = v[i].second;
    cur_sum += b[i];
    min_b = min(min_b, min_b + b[i]);
    max_b = max(max_b, cur_sum);
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 0, n, r, abs(min_b));
}
