object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, k = sc.nextInt()
  val a = Array.fill(n)(sc.nextInt()).filter(_ < k)
  val m = a.length

  def compose(x1: Int, x2: Int): Int = {
    x1 * k + x2
  }

  if (m == 0) {
    println(0)
  } else {
    val dpf = Array.fill(m * k)(false)
    dpf(0) = true
    for {
      i <- 1 until m
      j <- 0 until k
    } {
      if (a(i-1) <= j) {
        dpf(compose(i, j)) = dpf(compose(i-1, j)) || dpf(compose(i-1, j - a(i-1)))
      } else {
        dpf(compose(i, j)) = dpf(compose(i-1, j))
      }
    }

    val dpb = Array.fill(m * k)(false)
    dpb(0) = true
    for {
      i <- 1 until m
      j <- 0 until k
    } {
      if (a(m-i) <= j) {
        dpb(compose(i, j)) = dpb(compose(i-1, j)) || dpb(compose(i-1, j - a(m-i)))
      } else {
        dpb(compose(i, j)) = dpb(compose(i-1, j))
      }
    }

    var ans = 0
    for (i <- 0 until m) {
      val x = a(i)
      var count = 0
      for (jb <- k-x until k if dpb(compose(m-i-1, jb))) {
        count += 1
      }
      var found = false
      if (dpf(compose(i, 0)) && count > 0) {
        found = true
      }

      var jf = 1
      while (!found && jf < k) {
        if (dpb(compose(m-i-1, k-jf))) {
          count -= 1
        }
        if (k-x-jf >= 0 && dpb(compose(m-i-1, k-x-jf))) {
          count += 1
        }
        if (dpf(compose(i, jf)) && count > 0) {
          found = true
        }
        jf += 1
      }

      if (!found) {
        ans += 1
      }
    }

    println(ans)
  }
}
