#include <bits/stdc++.h>
using namespace std;
struct E {
  int floor, time;
};
bool cmp(const E &a, const E &b) { return a.floor > b.floor; }
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  E e[n];
  for (int i = 0; i < n; i++) scanf("%d%d", &e[i].floor, &e[i].time);
  sort(e, e + n, cmp);
  int ans = 0, now = s;
  for (int i = 0; i < n; i++) {
    ans += now - e[i].floor;
    if (ans < e[i].time) ans = e[i].time;
    now = e[i].floor;
  }
  ans += e[n - 1].floor;
  printf("%d", ans);
  return 0;
}
