#include <bits/stdc++.h>
using namespace std;
struct pas {
  int f, t;
};
int main() {
  int n, s;
  cin >> n >> s;
  pas x[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i].f >> x[i].t;
  }
  int res = 0, fl = s;
  for (int i = n - 1; i >= 0; i--) {
    res += fl - x[i].f;
    fl = x[i].f;
    res += max(0, x[i].t - res);
  }
  res += fl;
  cout << res << endl;
}
