#include <bits/stdc++.h>
using namespace std;
struct detail {
  int f, t;
} * a;
void solve() {
  int n, s, time = 0;
  cin >> n >> s;
  a = new detail[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> a[i].f >> a[i].t;
  }
  a[n].f = s;
  a[n].t = 0;
  for (int i = n - 1; i >= 0; i--) {
    time += a[i + 1].f - a[i].f;
    if (a[i].t - time > 0) time += a[i].t - time;
  }
  time += a[0].f;
  cout << time;
}
int main() {
  solve();
  return 0;
}
