#include <bits/stdc++.h>
#define INF 13000000
using namespace std;
long g, w, e, c, costs[ 100 * 1000 ];
int main()
{
ifstream cin("energii.in");
ofstream cout("energii.out");
cin >> g >> w;
for (long i = 0; i <= w; i++)
costs[ i ] = INF;
for (long i = 0; i < g; ++i){
cin >> e >> c;
for (long j=w; j>e; --j)
if (c + costs[j-e] < costs[j])
costs[ j ] = c + costs[j-e];
for(long j=0; j<=e&&j<=w; ++j)
if(costs[j]>c)
costs[j]=c;
}
if(costs[w]!=INF)
cout << costs[w] <<'\n';
else
cout<<"-1" << endl;
return 0;
}