#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, piso, tiempo;
  cin >> n >> s;
  vector<pair<int, int> > p(n);
  for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  p.push_back(pair<int, int>(s, 0));
  p.push_back(pair<int, int>(0, 0));
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  int acu = 0;
  for (int i = 0; i < p.size() - 1; i++) {
    if (acu < p[i].second) acu += (p[i].second - acu);
    acu += (p[i].first - p[i + 1].first);
  }
  cout << acu << endl;
  return 0;
}
