def main():

    N, K = list(map(int, input().split()))

    A = list(map(int, input().split()))

    A.sort()





    # [ok, ng) - Maximum

    # (ng, ok] - Minimum

    # ok が 最終的な答え

    ok = N

    ng = -1

    while abs(ok - ng) > 1:

        mid = (ok + ng) // 2

        n = mid

        dp = [0] * (K + 1)

        dp[0] = 1

        for i in range(N):

            a = A[i]

            if i == n or a >= K:

                continue

            for j in range(K, -1, -1):

                dp[min(K, j + a)] |= dp[j]

        rst = any(dp[k] for k in range(max(0, K - A[n]), K))

        if rst:

            ok = mid

        else:

            ng = mid

    print(ok)





main()

def main():

    N, K = list(map(int, input().split()))

    A = list(map(int, input().split()))

    A.sort()





    # [ok, ng) - Maximum

    # (ng, ok] - Minimum

    # ok が 最終的な答え

    ok = N

    ng = -1

    while abs(ok - ng) > 1:

        mid = (ok + ng) // 2

        n = mid

        dp = [0] * (K + 1)

        dp[0] = 1

        for i in range(N):

            a = A[i]

            if i == n or a >= K:

                continue

            for j in range(K, a - 1, -1):

                dp[j] |= dp[j - a]

        rst = any(dp[k] for k in range(max(0, K - A[n]), K))

        if rst:

            ok = mid

        else:

            ng = mid

    print(ok)





main()

def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    A.sort()
    # [ok, ng) - Maximum
    # (ng, ok] - Minimum
    # ok が 最終的な答え
    ok = N
    ng = -1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        n = mid
        dp = [0] * (K + 1)
        dp[0] = 1
        for i in range(N):
            a = A[i]
            if i == n or a >= K:
                continue
            for j in range(K, -1, -1):
                dp[min(K, j + a)] |= dp[j]
        rst = any(dp[k] for k in range(max(0, K - A[n]), K))
        if rst:
            ok = mid
        else:
            ng = mid
    print(ok)


main()

def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    A.sort()
    # [ok, ng) - Maximum
    # (ng, ok] - Minimum
    # ok が 最終的な答え
    ok = N
    ng = -1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        n = mid
        dp = [0] * (K + 1)
        dp[0] = 1
        for i in range(N):
            a = A[i]
            if i == n or a >= K:
                continue
            for j in range(K, a - 1, -1):
                dp[j] |= dp[j - a]
        rst = any(dp[k] for k in range(max(0, K - A[n]), K))
        if rst:
            ok = mid
        else:
            ng = mid
    print(ok)


main()

-            for j in range(K, -1, -1): -                dp[min(K, j + a)] |= dp[j] +            for j in range(K, a - 1, -1): +                dp[j] |= dp[j - a]