#include <bits/stdc++.h>
#define ll long long
#define fo(i,d,c) for(int i=d;i<=c;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int n;
int l;
struct hieu {
ll a;
ll b;
};
const int N=1e6;
hieu c[N+1];
bool check (ll d, int l, hieu c[])
{
int tmp=0;
fo(i,1,n){
if(c[i].a<d){
tmp=tmp+((d-c[i].a+c[i].b-1)/c[i].b);
}
if(tmp>l){
return 0;
}
}
return 1;
}
ll solve()
{
ll left=0;
ll right=0;
fo(i,1,n){
right=max(right,(ll)c[i].a+l*c[i].b);
}
ll res,mid;
while(left<=right){
mid=(left+right)/2;
if(check(mid,l,c)){
left=mid+1;
res=mid;
}
else{
right=mid-1;
}
}
return res;
}
int main()
{
IOS;
cin>>n>>l;
fo(i,1,n){
cin>>c[i].a;
cin>>c[i].b;
}
cout<<(ll)solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgZm8oaSxkLGMpIGZvcihpbnQgaT1kO2k8PWM7aSsrKQojZGVmaW5lIElPUyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApO2Npbi50aWUoMCk7Y291dC50aWUoMCk7Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG47CmludCBsOwpzdHJ1Y3QgaGlldSB7CiAgICBsbCBhOwogICAgbGwgYjsKfTsKY29uc3QgaW50IE49MWU2OwpoaWV1IGNbTisxXTsKYm9vbCBjaGVjayAobGwgZCwgaW50IGwsIGhpZXUgY1tdKQp7CiAgICBpbnQgdG1wPTA7CiAgICBmbyhpLDEsbil7CiAgICAgICAgaWYoY1tpXS5hPGQpewogICAgICAgICAgICB0bXA9dG1wKygoZC1jW2ldLmErY1tpXS5iLTEpL2NbaV0uYik7CiAgICAgICAgfQogICAgICAgIGlmKHRtcD5sKXsKICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDE7Cn0KbGwgc29sdmUoKQp7CiAgICBsbCBsZWZ0PTA7CiAgICBsbCByaWdodD0wOwogICAgZm8oaSwxLG4pewogICAgICAgIHJpZ2h0PW1heChyaWdodCwobGwpY1tpXS5hK2wqY1tpXS5iKTsKICAgIH0KICAgIGxsIHJlcyxtaWQ7CiAgICB3aGlsZShsZWZ0PD1yaWdodCl7CiAgICAgICAgbWlkPShsZWZ0K3JpZ2h0KS8yOwogICAgICAgIGlmKGNoZWNrKG1pZCxsLGMpKXsKICAgICAgICAgICAgbGVmdD1taWQrMTsKICAgICAgICAgICAgcmVzPW1pZDsKICAgICAgICB9CiAgICAgICAgZWxzZXsKICAgICAgICAgICAgcmlnaHQ9bWlkLTE7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIHJlczsKfQppbnQgbWFpbigpCnsKICAgIElPUzsKICAgIGNpbj4+bj4+bDsKICAgIGZvKGksMSxuKXsKICAgICAgICBjaW4+PmNbaV0uYTsKICAgICAgICBjaW4+PmNbaV0uYjsKICAgIH0KICAgIGNvdXQ8PChsbClzb2x2ZSgpOwogICAgcmV0dXJuIDA7Cn0K