#include <bits/stdc++.h>
using namespace std;
int n, s, t;
pair<int, int> p[1000];
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
    p[i].first *= -1;
  }
  sort(p, p + n);
  for (int i = 0; i < n; i++) {
    int u = -p[i].first;
    int v = p[i].second;
    t += s - u;
    s = u;
    if (t < v) {
      t = v;
    }
  }
  t += s;
  cout << t << "\n";
  return 0;
}
