#include <bits/stdc++.h>
using namespace std;
int a[1000], b[1000], n, s;
void Swap(int &a, int &b) {
  int temp = a;
  a = b;
  b = temp;
}
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (a[i] < a[j]) {
        Swap(a[i], a[j]);
        Swap(b[i], b[j]);
      }
  int kq = max(s - a[1], b[1]);
  for (int i = 2; i <= n; i++) {
    kq = max(b[i], kq - a[i] + a[i - 1]);
  }
  kq = kq + a[n];
  cout << kq;
}
