#include <bits/stdc++.h>
int cfc(const void *a, const void *b) {
  if (*(long long *)a > *(long long *)b)
    return -1;
  else if (*(long long *)a < *(long long *)b)
    return 1;
  else
    return 0;
}
int max(int a, int b) {
  if (a > b)
    return a;
  else
    return b;
}
int main() {
  clock_t lnh = clock();
  int n, s;
  scanf("%d%d", &n, &s);
  int f, t, i, mx;
  for (i = 0, mx = 0; i < n; i++) {
    scanf("%d%d", &f, &t);
    mx = max(mx, max(s - f, t) + f);
  }
  printf("%d\n", mx);
  clock_t cls = clock();
  return 0;
}
