#include<cstdio>
using namespace std;
int g,n,e[1005],c[1005],v[5005],minim=999999999,energie;
int main()
{
freopen("energii.in","r",stdin);
freopen("energii.out","w",stdout);
scanf("%d",&g);
scanf("%d",&n);
for(int i=1;i<=g;i++)
{
scanf("%d%d",&e[i],&c[i]);
}
int maxim=0;
v[0]=0;
for(int i=1;i<=n;i++) v[i]=-1;
for(int i=0;i<=maxim;i++)
{
if (v[i]!=-1)
{
for(int j=1;j<=g;j++)
{
if ((i+e[j])<=n)
{
if (v[i+e[j]]==-1 || (v[i+e[j]]>(v[i]+c[j])))
{
v[i+e[j]]=v[i]+c[j];
if ((i+e[j])>maxim) maxim=(i+e[j]);
}
}
else
if ((i+e[j])>n)
{
if ((v[i]+c[j])<minim)
{
minim=v[i]+c[j];
energie=i+e[j];
}
}
}
}
}
if (v[n]!=-1) printf("%d\n",v[n]);
else printf("%d\n",minim);
return 0;
}