fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map {it.toInt()}
    val a = readLine()!!.split(" ").map{it.toLong()}.sorted()

    var l = -1
    var u = a.size

    while (u - l > 1) {
        val c = (l + u) / 2

        fun judge(c: Int): Boolean {
            if (a[c] >= K) return true

            val dp = BooleanArray(K) { false }
            dp[0] = true

            for (i in a.indices) {
                if (i == c) continue
                if (a[i] >= K) continue

                for (k in K - 1 downTo a[i].toInt()) {
                    dp[k] = dp[k] || dp[k - a[i].toInt()]
                }
            }

            for (i in K - a[c].toInt() until K) {
                if (dp[i]) return true
            }

            return false
        }

        if (judge(c)) {
            u = c
        } else {
            l = c
        }
    }

    println(u)
}
