#include <iostream>
#include <vector>
#include <queue>

using namespace std;

typedef unsigned int uint;
typedef pair<uint, int> P;

int main() {
	uint N, X;
	cin >> N >> X;
	vector<P> b(N); //first: cost, second: dist
	for (uint i = 0; i < N; i++) {
		cin >> b[i].second >> b[i].first;
	}
	priority_queue<P, vector<P>, greater<P> > q;
	vector<uint> d(300000, -1);
	d[0] = 0;
	q.push(P(0, 0));
	while (!q.empty()) {
		P e = q.top();
		q.pop();
		if (e.first > d[e.second]) {
			continue;
		}
		for (uint i = 0; i < N; i++) {
			uint cost = b[i].first + e.first;
			uint x = b[i].second + e.second;
			if (x < 300000 && cost < d[x]) {
				d[x] = cost;
				q.push(P(cost, x));
			}
			int y = e.second - b[i].second;
			if (y >= 0 && cost < d[y]) {
				d[y] = cost;
				q.push(P(cost, y));
			}
		}
	}
	cout << (signed)d[X] <<endl;
	return 0;
}
