#include <bits/stdc++.h>
#define forloop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ll long long int
#define ld long double
#define pb emplace_back
#define ravi ios_base::sync_with_stdio(false);
#define parmar2002 cin.tie(NULL); cout.tie(NULL);
#define nl "\n"
#define sclock clock_t tStart = clock();
#define eclock printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define finout freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define whole(x) x.begin(), x.end()
#define wholer(x) x.rbegin(), x.rend()
#define len(s) s.size()
#define endline cout << "\n";
#define T(T) ll tt; cin >> tt; forloop(T, 1, tt + 1)
#define retf(flag, x) if(flag) {cout<<x<<nl; return;}
#define vint vector<int>
#define forv(arr) for(auto i:arr) cout<<i<<" "; endline;
#define forin(arr) for(auto &i : arr) cin>>i;
#define ret(x) {cout<<x<<nl; return;}
using namespace std;
class Solution {
public:

};
void solve();
int main()
{
	ravi parmar2002
	// finout //In case of File input output
	// sclock
	// T(T)
	solve();
	// eclock
	return 0;
}
void solve()
{ 
	ll n, k;
	cin>>n>>k;
	vector<pair<ll, ll>>arr(n);
	for(auto &i:arr) cin>>i.first>>i.second;
	arr.pb(make_pair(0, 0));
	sort(whole(arr));
	ll prev = 0;
	forloop(i, 1, len(arr))
	{
		if(arr[i].first - arr[i-1].first <= k) 
		k -=  (arr[i].first - arr[i-1].first);
		else ret(arr[i-1].first + k);
		k += arr[i].second;
	}
	cout<<arr.back().first + k;
}
#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;
}
