#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9) + 123;
inline void boost() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
int main() {
  boost();
  int n, x, sum = 0;
  cin >> n >> x;
  pair<int, int> a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      sum = sum + x - a[i].first;
    }
    if (i != 0) {
      sum = sum + a[i - 1].first - a[i].first;
    }
    if (a[i].second >= sum) {
      sum = sum + a[i].second - sum;
    }
  }
  cout << sum + a[n - 1].first - 0;
}
