#include <bits/stdc++.h>
struct evt {
  int floor;
  int time;
};
int evtcmp(const void* a, const void* b) {
  struct evt* e = (struct evt*)a;
  struct evt* f = (struct evt*)b;
  return (e->floor < f->floor) - (e->floor > f->floor);
}
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  struct evt evts[1001];
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d %d", &evts[i].floor, &evts[i].time);
  }
  qsort(evts, n, sizeof(struct evt), evtcmp);
  int time = 0;
  for (i = 0; i < n; i++) {
    if (evts[i].floor < s) {
      time += (s - evts[i].floor);
      s = evts[i].floor;
    }
    if (evts[i].time > time) {
      time = evts[i].time;
    }
  }
  if (s > 0) {
    time += s;
  }
  printf("%d\n", time);
  return 0;
}
