#include <bits/stdc++.h>
struct stops {
  int floor;
  int time;
};
int main() {
  int n, N;
  while (scanf("%d%d", &n, &N) != EOF) {
    struct stops a[n + 1];
    int i, j, m, T;
    for (i = 0; i < n; i++) {
      scanf("%d%d", &a[i].floor, &a[i].time);
    }
    a[n].floor = 0;
    a[n].time = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < n - i; j++) {
        if (a[j].floor < a[j + 1].floor) {
          m = a[j].floor;
          a[j].floor = a[j + 1].floor;
          a[j + 1].floor = m;
          m = a[j].time;
          a[j].time = a[j + 1].time;
          a[j + 1].time = m;
        }
      }
    }
    T = N - a[0].floor;
    for (i = 0; i < n; i++) {
      if (T < a[i].time) T = a[i].time;
      T = T + a[i].floor - a[i + 1].floor;
    }
    printf("%d", T);
  }
}
