#include <bits/stdc++.h>
using namespace std;
struct cap {
  long long tang, tg;
};
bool tmp(cap a, cap b) {
  if (a.tang == b.tang)
    return a.tg < b.tg;
  else
    return a.tang > b.tang;
}
int main() {
  long long n, s;
  cin >> n >> s;
  cap arr[n];
  long long i;
  for (i = 0; i < n; i++) {
    cin >> arr[i].tang >> arr[i].tg;
  }
  sort(arr, arr + n, tmp);
  long long tructhoigian = 0;
  long long vt = s;
  for (i = 0; i < n; i++) {
    tructhoigian = tructhoigian + (vt - arr[i].tang);
    vt = arr[i].tang;
    if (arr[i].tg > tructhoigian) tructhoigian = arr[i].tg;
  }
  if (vt > 0) {
    tructhoigian += vt;
  }
  cout << tructhoigian;
}
