#include <bits/stdc++.h>
using namespace std;
int a[104], b[104];
int main() {
  int p, f, n, i = 0, tt = 0;
  cin >> p >> f;
  for (i = 1; i <= p; i++) cin >> a[i] >> b[i];
  tt += (f - a[p]);
  tt += (max(0, b[p] - tt));
  for (i = p - 1; i >= 1; i--) {
    tt += (a[i + 1] - a[i]);
    tt += (max(0, b[i] - tt));
  }
  tt += a[1];
  cout << tt;
  return 0;
}
