#include <bits/stdc++.h>
const double PI = acos(-1.0);
const double e = exp(1.0);
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
inline T Min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline T Max(T a, T b) {
  return a > b ? a : b;
}
bool cmpbig(int a, int b) { return a > b; }
bool cmpsmall(int a, int b) { return a < b; }
using namespace std;
int f[10005];
int main() {
  int n, s;
  while (~scanf("%d %d", &n, &s)) {
    memset(f, 0, sizeof(f));
    for (int i = 0; i < n; i++) {
      int num, t;
      scanf("%d %d", &num, &t);
      f[num] = max(f[num], t);
    }
    int ans = 0;
    if (f[s] != 0) ans = f[s];
    for (int i = s - 1; i > 0; i--) {
      ans += 1;
      if (f[i] > ans) ans = f[i];
    }
    ans++;
    printf("%d\n", ans);
  }
  return 0;
}
