#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int pow(int a, int b, int p) {
  if (!b) return 0;
  int t = pow(a, b / 2, p);
  if (b & 1)
    return t * t * a % p;
  else
    return t * t % p;
}
void solve() {
  int n, s, x, y, t(0);
  cin >> n >> s;
  int a[s + 1];
  memset(a, 0, sizeof(a));
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    a[x] = max(a[x], y);
  }
  for (int i = s; i > 0; i--) {
    if (a[i] != 0)
      if (a[i] > t) t += a[i] - t;
    t++;
  }
  cout << t;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
