#include <bits/stdc++.h>
int main() {
  int n, s, max, temp, temp2;
  int i, j, k;
  int cp, sum = 0, tp = 0;
  scanf("%d%d", &n, &s);
  int f[n], t[n];
  for (i = 0; i < n; i++) scanf("%d%d", &f[i], &t[i]);
  for (i = 0; i < n - 1; i++) {
    max = f[i];
    for (j = i + 1; j < n; j++) {
      if (max < f[j]) {
        max = f[j];
        temp = f[i];
        f[i] = f[j];
        f[j] = temp;
        temp2 = t[i];
        t[i] = t[j];
        t[j] = temp2;
      }
    }
  }
  cp = s;
  tp = cp - f[0];
  i = 0;
  while (i < n) {
    tp = cp - f[i] + sum;
    if (tp < t[i]) {
      sum = sum + (cp - f[i]) + (t[i] - tp);
    } else {
      sum = sum + (cp - f[i]);
    }
    cp = f[i];
    i++;
  }
  sum = sum + cp;
  printf("%d", sum);
  return 0;
}
