fun main() {
    val (n,k) = readLine()!!.split(" ").map { it.toInt() }
    val arr = readLine()!!.split(" ").map { it.toInt() }.sorted()

    fun isNecessary(idx:Int): Boolean {
        if(arr[idx] >= k)
            return true
        val dp = Array(2){BooleanArray(k+1){false} }
        var cur = 0
        var next = 1
        dp[cur][0] = true
        dp[next][0] = true

        for(i in arr.indices) {
            if(i == idx) continue
            val v = arr[i]
            for(j in 1..k) {
                dp[next][j] = dp[cur][j]
            }
            for(j in 1..k) {
                if(j - v < 0) continue
                dp[next][j] =  dp[next][j] or dp[cur][j-v]
                if(j >= k - arr[idx] && j <= k - 1 && dp[next][j])
                    return true
            }
            cur = (cur + 1) % 2
            next = (next + 1) % 2
        }
        return false
    }
    var ans = n
    var l = 0
    var r = n - 1
    while(l <= r) {
        val mid = (l + r) / 2
        if(isNecessary(mid)) {
            r = mid - 1
            ans = mid
        } else {
            l = mid + 1
        }
    }
    print(ans)
    // 2 3 4 10 10 25
    // 0 1 2 3 4 5
}