#include <bits/stdc++.h>
int passenger[101][2], n, s;
int main() {
  scanf("%d %d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &passenger[i][0], &passenger[i][1]);
  }
  int present = s, time = 0;
  for (int i = n; i >= 1; i--) {
    if (time + present - passenger[i][0] < passenger[i][1]) {
      time = passenger[i][1];
      present = passenger[i][0];
    } else {
      time += present - passenger[i][0];
      present = passenger[i][0];
    }
  }
  time += present;
  printf("%d", time);
}
