import scala.collection.mutable

object Main extends App {
  import scala.io.StdIn._

  val Array(n, x) = readLine.trim.split(' ').map(_.toInt)
  val warps = Array.tabulate(n){_ ⇒
    val Array(d, c) = readLine.trim.split(' ').map(_.toInt)
    Warp(d, c)
  }
  val minCost = Array.tabulate(math.max(2 * x, warps.maxBy(_.distance).distance * 2) + 1) { _ ⇒ Long.MaxValue }
  minCost(0) = 0
  val queue = mutable.PriorityQueue()(Ordering.by[(Int, Long), Long](_._2).reverse)
  queue.enqueue((0, 0))
  while(queue.nonEmpty && queue.head._1 != x){
    val (current, cost) = queue.dequeue()
    if (minCost(current) == cost){
      for (Warp(d, c) ← warps) {
        if (minCost.indices.contains(d + current) && minCost(d + current) > cost + c){
          minCost(d + current) = cost + c
          queue.enqueue((d + current, cost + c))
        }
        if (minCost.indices.contains(current - d) && minCost(current - d) > cost + c){
          minCost(current - d) = cost + c
          queue.enqueue((current - d, cost + c))
        }
      }
    }
  }
  println(if (queue.isEmpty) -1 else minCost(x))
  case class Warp(distance: Int, cost: Int)
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline def let[A](@inline func: T ⇒ A): A = func(value)
  }
}
