#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<int, int>& p1, const pair<int, int>& p2) {
  return (p1.first > p2.first);
}
int main() {
  int n, s;
  cin >> n >> s;
  vector<pair<int, int> > v(n);
  for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end(), compare);
  int cur = 0;
  for (int i = 0; i < n; i++) {
    cur += (s - v[i].first);
    s = v[i].first;
    if (v[i].first != 0 && v[i].second > cur) {
      cur = v[i].second;
    }
  }
  if (s != 0) cur += (s);
  cout << cur << endl;
}
