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){false}
  println(
    upperBound(0, n){cardIndex ⇒
      val card = cards(cardIndex)
      if (card < k) {
        for (i ← 0 until k) memo(i) = false
        memo(0) = true
        var isNeed = false
        for (i ← 0 until n if i != cardIndex && !isNeed) {
          val c = cards(i)
          for (i ← (0 until  k - c).reverse if memo(i) && !isNeed) {
            memo(i + c) = true
            isNeed = i + c + card >= k
          }
        }
        isNeed
      }else true
    }
  )
  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
  }
}