#include <bits/stdc++.h>
using namespace std;
struct pass {
  int f, t;
};
pass a[1000];
bool cmp(pass a, pass b) {
  if (a.f == b.f) return a.t > b.t;
  return a.f > b.f;
}
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i].f >> a[i].t;
  }
  sort(a, a + n, cmp);
  int cur = s, time = 0;
  for (int i = 0; i < n; i++) {
    time += cur - a[i].f;
    cur = a[i].f;
    if (a[i].t > time) time += a[i].t - time;
  }
  if (cur != 0) time += cur;
  cout << time;
}
