#include <bits/stdc++.h>
using namespace std;
int main() {
  int s, n;
  cin >> n >> s;
  int f[n], t[n];
  vector<pair<int, int>> V;
  for (int i = 0; i < n; i++) {
    cin >> f[i] >> t[i];
    V.push_back(make_pair(f[i], t[i]));
  }
  sort(V.begin(), V.end());
  int temps = s - V[n - 1].first;
  int i = n - 1, floors = 0;
  while (i > 0) {
    int diff = 0;
    if (V[i].second >= temps) {
      temps = V[i].second;
    }
    floors = V[i].first - V[i - 1].first;
    temps += floors;
    i--;
  }
  if (V[0].second >= temps) {
    cout << V[0].second + V[0].first;
  } else
    cout << temps + V[0].first;
  return 0;
}
