#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1e+9 * 2;
int n, x, d[16], c[16], ofs = 100010;
int dir[200100];

void dijkstra(int s){
	for(int i = 0; i < 200100; ++i)
		dir[i] = INF;
	dir[s] = 0;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while(!que.empty()){
		P p = que.top();
		que.pop();
		int v = p.second;
		if(dir[v] < p.first)
			continue;
		for(int i = 0; i < n; ++i){
			int next1 = v + d[i], next2 = v - d[i];
			if(next1 < 200100 && dir[next1] > p.first + c[i]){
				dir[next1] = p.first + c[i];
				que.push(P(p.first + c[i], next1));
			}
			if(next2 >= 0 && dir[next2] > p.first + c[i]){
				dir[next2] = p.first + c[i];
				que.push(P(p.first + c[i], next2));
			}
		}
	}
	return;
}

int main() {
		
	cin >> n >> x;
	for(int i = 0; i < n; ++i){
		cin >> d[i] >> c[i];
	}
	dijkstra(ofs);
	if(dir[ofs + x] == INF)
		cout << "-1" << endl;
	else
		cout << dir[ofs + x] << endl;
	return 0;
}
