#include <bits/stdc++.h>
using namespace std;
unsigned long long n,b,sam=0,cnt,ty;
struct node
{
long long p,c;
}a[100005];
bool cmp(node x,node y)
{
if (x.p<y.p)return 1;
else return 0;
}
int main()
{
cin>>n>>b;
for(int i=1;i<=n;i++) cin>>a[i].p>>a[i].c;
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++)
{
cnt=a[i].p*a[i].c;
if(b>=cnt)
{
b=b-cnt;
sam+=a[i].c;
}
else
{
while(b>=a[i].p)
{
b=b-a[i].p;
sam++;
}
cout<<sam;
return 0;
}
}
cout<<sam;
return 0;
}