#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
 
// #define fisier 1
 
using namespace std;
 
typedef long long ll;
 
const int mod = 1000000007;
const double dancila = 3.14159265359; // PI 
const double eps = 1e-9;
 
int n;
ll k;

vector<pair<ll, ll> > v;
 
int main()
{
	#ifdef fisier
		ifstream cin("input.in");
		ofstream cout("output.out");
	#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n >> k;
	for(int i = 1; i <= n; ++i)
	{
		ll a, b;
		cin >> a >> b;
		v.push_back({a, b});
	}
	sort(v.begin(), v.end());
	v.push_back({(1LL<<62), 0});
	
	ll current_place = 0;
	for(int i = 0; i < v.size(); ++i)
	{
		if(v[i].first - current_place > k)
		{
			current_place += k;
			break;
		} 
		
		k -= (v[i].first - current_place);
		k += v[i].second;
		current_place = v[i].first;
		
	}
	
	cout << current_place;
	
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, K;
    cin >> N >> K;
    vector<pll> P(N);
    REP(i,0,N) cin >> P[i].first >> P[i].second;

    ASC(P);
    ll p = 0;
    bool f = true;
    REP(i,0,N) {
        ll a = P[i].first, b = P[i].second;
        if(K >= a - p) {
            K = K - (a - p) + b;
            p = a;
        }
        else {
            p += K;
            f = false;
            break;
        }
    }
    if(f) p += K;
    PR(p);

    return 0;
}

/*



*/