#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  ;
  ;
  vector<int> arrival_times(s + 1, 0);
  for (int i = (0); i < (n); i++) {
    int fi, ti;
    scanf("%d %d", &fi, &ti);
    ;
    ;
    arrival_times[fi] = max(arrival_times[fi], ti);
    ;
  };
  int time_passed = 0;
  for (int level = (s); level >= (1); level--) {
    time_passed = max(time_passed, arrival_times[level]);
    ;
    time_passed += 1;
  }
  printf("%d\n", time_passed);
  ;
  return 0;
}
