#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > v;
int main() {
  ios_base::sync_with_stdio(false);
  long long int n, second, a, b;
  cin >> n >> second;
  long long int tim = 0;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    v.push_back({a, b});
  }
  sort(v.rbegin(), v.rend());
  long long int prev = second;
  for (int i = 0; i < n; i++) {
    tim += (prev - v[i].first);
    prev = v[i].first;
    if (tim < v[i].second) {
      tim = v[i].second;
    }
  }
  tim += (prev - 0);
  cout << tim << '\n';
  return 0;
}
