#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

#define A_MAX 1000000000000000000

int main(){
  ll N,K;
  cin >> N >> K;
  map<ll,ll> A;

  ll a,b;
  for(int i=0;i<N;++i){
    cin >> a >> b;
    --a;
    A[a]+=b;
  }

  ll now=0;
  for(auto p: A){
    ll index=p.first;
    ll k=p.second;
    if(K<=index){
      cout << K << endl;
      return 0;
    }
    K+=k;
  }

  cout << K << endl;
  
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define fi first
#define se second
const int maxn=2e5+5;
struct fri
{
	ll pos,val;
}f[maxn];
int n;
ll k;
bool cmp(fri aa,fri bb)
{
	return aa.pos<bb.pos;
}
int main()
{

	scanf("%d%lld",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld%lld",&f[i].pos,&f[i].val);
	sort(f+1,f+n+1,cmp);
	ll now=0;
	for(int i=1;i<=n;i++)
	{
		if(now+k>=f[i].pos)
		{
			k-=f[i].pos-now;
			now=f[i].pos;
			k+=f[i].val;
		}
		else break;
	}
	now+=k;
	printf("%lld",now);
	return 0;
}