#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 3, M = 4e5;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
int n, r, a, b, x, y, id;
pair<long long, long long> pos[N], neg[N], p[N];
int dp[N][M], ans;
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first + a.second > b.first + b.second;
}
void process() {
  cin >> n >> r;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    if (b >= 0)
      pos[++x] = pair<long long, long long>(a, b);
    else
      neg[++y] = pair<long long, long long>(max(a, -b), b);
  }
  sort(pos + 1, pos + 1 + x);
  sort(neg + 1, neg + 1 + y, cmp);
  for (int i = 1; i <= x; i++) p[i] = pos[i];
  for (int i = 1; i <= y; i++) p[i + x] = neg[i];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < M; j++) dp[i][j] = -INF;
  }
  dp[0][r] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < M; j++) dp[i][j] = dp[i - 1][j];
    for (int j = 0; j < M; j++) {
      int pre = j - p[i].second;
      if (pre < M && pre >= p[i].first)
        dp[i][j] = max(dp[i][j], dp[i - 1][pre] + 1);
      ans = max(ans, dp[i][j]);
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  process();
  return 0;
}
