#include <bits/stdc++.h>

using pli = std::pair<long long, int>;

int main()
{
	int N, x;
	scanf("%d%d", &N, &x);
	std::vector<int> d(N), c(N);
	for (int i{}; i < N; i++)
		scanf("%d%d", &d[i], &c[i]);

	int max_place{x + 2 * *std::max_element(d.begin(), d.end())};
	std::vector<long long> dist(max_place + 1, 1LL << 60);
	std::priority_queue<pli, std::vector<pli>, std::greater<pli>> dij;
	dist[0] = 0;
	dij.push({0, 0});
	while (!dij.empty())
	{
		auto now{dij.top()};
		dij.pop();
		if (now.first > dist[now.second]) continue;
		if (now.second == x) break;
		for (int i{}; i < N; i++)
		{
			int next[2]{now.second - d[i], now.second + d[i]};
			for (int j{}; j < 2; j++)
			{
				if (next[j] < 0 || max_place < next[j]) continue;
				if (dist[next[j]] <= now.first + c[i]) continue;
				dist[next[j]] = now.first + c[i];
				dij.push({dist[next[j]], next[j]});
			}
		}
	}
	if (dist[x] == (1LL << 60))
		puts("-1");
	else
		printf("%lld\n", dist[x]);

	return 0;
}

