#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[1002];
int n, s;
int ans;
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) cin >> p[i].first >> p[i].second;
  sort(p + 1, p + n + 1);
  for (int i = n; i > 0; --i)
    ans = max(ans + s - p[i].first, p[i].second), s = p[i].first;
  cout << ans + p[1].first << endl;
  return 0;
}
