#include <bits/stdc++.h>
using namespace std;
const long long maxn = (long long)1e5 + 9;
const long long mod = (long long)1e9 + 7;
vector<pair<int, int> > a;
bool comp(pair<int, int> l, pair<int, int> r) { return l.first > r.first; }
int main() {
  std::ios::sync_with_stdio(0);
  long long i, j, k, t, q, m, l, r, n;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> j >> t;
    a.push_back(make_pair(j, t));
  }
  sort(a.begin(), a.end(), comp);
  long long ans =
      ((k - a[0].first) > (a[0].second) ? (k - a[0].first) : (a[0].second));
  for (i = 1; i <= n - 1; i++) {
    ans = ((ans + a[i - 1].first - a[i].first) > (a[i].second)
               ? (ans + a[i - 1].first - a[i].first)
               : (a[i].second));
  }
  ans += a[n - 1].first - 0;
  cout << ans << '\n';
}
