#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[100005];
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
  }
  sort(a, a + n);
  int t = 0;
  for (int i = n - 1; i >= 0; i--) {
    t += s - a[i].first;
    t = max(t, a[i].second);
    s = a[i].first;
  }
  printf("%d\n", t + s);
  return 0;
}
