#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, s;
  cin >> n >> s;
  long long int f[n], t[n];
  for (int i = 0; i < n; i++) {
    cin >> f[i] >> t[i];
  }
  long long int time = 0;
  time += (s - f[n - 1]);
  if (time < t[n - 1]) {
    time += (t[n - 1] - time);
  }
  for (int i = n - 2; i >= 0; i--) {
    time += (f[i + 1] - f[i]);
    if (time < t[i]) {
      time += (t[i] - time);
    }
  }
  time += f[0];
  cout << time << "\n";
}
