#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <set>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

const int MAX = 1000000 + 1000;

int main(){
  const int n = getInt();
  const int x = getInt();

  vector<int> d(n);
  vector<int> c(n);
  REP(i,n){
    d[i] = getInt();
    c[i] = getInt();
  }

  const int inf = 1 << 30;
  vector<int> dp(MAX, inf);

  typedef pair<int, int> data;
  priority_queue<data, vector<data>, greater<data> > pq;

  pq.push(data(0, 0));

  while(pq.size()){
    const data dt = pq.top(); pq.pop();
    const int pos = dt.second;
    const int cost = dt.first;

    if(dp[pos] < cost) continue;
    dp[pos] = cost;

    if(pos == x) break;

    REP(i,n){
      REP(j,2){
        const int next = pos + (j ? 1 : -1) * d[i];
        const int cc = cost + c[i];

        if(0 <= next && next < MAX && dp[next] > cc){
          dp[next] = cc;
          pq.push(data(cc, next));
        }
      }
    }
  }

  printf("%d\n", dp[x] == inf ? -1 : dp[x]);

  return 0;
}
