#include <bits/stdc++.h>
using namespace std;
pair<int, int> A[110];
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; ++i) scanf("%d%d", &A[i].first, &A[i].second);
  sort(A, A + n);
  reverse(A, A + n);
  int res = 0;
  int stg = s;
  for (int i = 0; i < n; ++i) {
    int x = stg - A[i].first;
    stg -= x;
    res += x;
    if (res < A[i].second) {
      int y = A[i].second - res;
      res += y;
    }
  }
  if (stg != 0) {
    res += stg;
  }
  cout << res;
  return 0;
}
