import scala.io.StdIn._
object Main extends App {
  val Array(n, k) = readLine.trim.split(' ').map(_.toInt)
  val cards = readLine.trim.split(' ').map(_.toInt).sorted
  val memo = Array.fill(k + 1){false}
  println(
    upperBound(0, n){cardIndex ⇒
      for (i ← 0 to k) memo(i) = false
      memo(0) = true
      val card = cards(cardIndex)
      for (i ← 0 until n if i != cardIndex) {
        val c = cards(i)
        for (i ← (0 until k - c).reverse if memo(i)) {
          memo(i + c) = true
        }
      }
      (k - card to k).exists(memo)
    }
  )
  def upperBound(from: Int, until: Int)(@inline predicate: Int ⇒ Boolean): Int = {
    var left = 0
    var right = until
    while (left < right) {
      val mid = (left + right) / 2
      if (predicate(mid)) right = mid
      else left = mid + 1
    }
    right
  }
}