#include <bits/stdc++.h>
int main() {
  int i, m, sum, n, x, a, b, cost = 0, ara1[1000], ara2[1000];
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    ara2[i] = b;
    ara1[i] = a;
  }
  sum = 0;
  for (i = n - 1; i >= 0; i--) {
    sum = sum + (m - ara1[i]);
    if (ara2[i] > sum) {
      sum = sum + (ara2[i] - sum);
    }
    m = ara1[i];
  }
  sum = sum + ara1[0];
  printf("%d\n", sum);
  return 0;
}
