import java.util.*

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

    fun func(a: List<Int>): Array<IntArray> {
        val dp = Array(N + 1) { IntArray(K + 1) { 0 } }

        dp[0][0] = 1

        for (i in a.indices) {
            for (j in dp[i].indices) {
                dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j])

                val k = Math.min(K, j + a[i])
                dp[i + 1][k] = Math.max(dp[i + 1][k], dp[i][j])
            }
        }

        for (i in a.indices) {
            for (j in 1 .. K) {
                dp[i][j] += dp[i][j - 1]
            }
        }

        return dp
    }

    val dp = IntArray(K + 1)
    dp[0] = 1

    val rdp = func(a.reversed())

    var cnt = 0

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

        var r = false

        for (j in 0 .. K - 1) {
            if (dp[j] == 0)
                continue
            val l = Math.max(K - a[i] - j, 0)
            val u = K - j - 1

            r = r || (l == 0 && rdp[N - i - 1][l] > 0) || (rdp[N - i - 1][u] - rdp[N - i - 1][Math.max(l - 1, 0)] > 0)

            if (r) break
        }

        if (r) {
            cnt++
        }


        for (j in dp.indices.reversed()) {
            if (j - a[i] >= 0) {
                dp[j] = Math.max(dp[j], dp[j - a[i]])
            }
        }
    }

    println(N - cnt)
}
