#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 1;
map<long long, long long> mp, pm;
map<char, long long> hs;
deque<long long> v, vc, ve, vv, vd;
deque<char> p, pe;
deque<string> ts, ss, st;
deque<double> sd, ds;
long long a, b, c, d, e, f, cnt, ans, r, n, l, x, y;
long double q, t, cnt1, cnt2;
string g, h, w, o, m, s;
char z, u;
bool re, rt;
vector<pair<long long, long long> > pr, rp, pp;
map<pair<long long, long long>, long long> aw, wa;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(0);
  cin >> a >> b;
  for (long long i = 0; i < a; i++) {
    cin >> c >> d;
    pr.push_back({c, d});
  }
  sort(pr.rbegin(), pr.rend());
  for (long long i = 0; i < pr.size(); i++) {
    if (pr[i].first < b) {
      ans += b - pr[i].first;
      b = pr[i].first;
    }
    if (pr[i].second > ans) ans += pr[i].second - ans;
  }
  if (b > 0) ans += b;
  cout << ans;
}
