### BUGGY CODE ###

def examD():
    N, K = LI()
    A = LI(); A.sort()
    cur = int(0)
    """ 部分点
        for i in range(N):
        a = A[0:i] + A[i+1:]
        dp = [[0] * (K + 1) for _ in range(N)]
        dp[0][0] = 1
        for j in range(N-1):
            for k in range(K+1):
                dp[j+1][k] = max(dp[j][k],dp[j+1][k])
                if k-a[j]>=0:
                    dp[j+1][k] = max(dp[j+1][k],dp[j][k-a[j]])
#        print(dp)
        if K-A[i]>=0:
            #Kがちっちゃい時注意
            if sum(dp[-1][K - A[i]:K]) == 0:
                cur += 1
        else:
            if sum(dp[-1][:K]) == 0:
                cur += 1
    print(cur)
    """
    cur = int(0)
    ilower = 0; iupper = N-1; ic = (ilower+iupper)//2
    while(True):
        a = A[0:ic] + A[ic+1:]
        dp = [[0] * (K + 1) for _ in range(N)]
        dp[0][0] = 1
        for j in range(N-1):
            for k in range(K+1):
                dp[j+1][k] = max(dp[j][k],dp[j+1][k])
                if k-a[j]>=0:
                    dp[j+1][k] = max(dp[j+1][k],dp[j][k-a[j]])
#        print(dp)
        if iupper - ilower >= 2:
            if sum(dp[-1][max(0, K - A[ic]):K]) == 0:
                ilower = ic
                ic = (ic + iupper) // 2
            else:
                iupper = ic
                ic = (ic + ilower) // 2
        else:
            if sum(dp[-1][max(0, K - A[ic]):K])==0:
                ic = iupper
                a = A[0:ic] + A[ic + 1:]
                dp = [[0] * (K + 1) for _ in range(N)]
                dp[0][0] = 1
                for j in range(N - 1):
                    for k in range(K + 1):
                        dp[j + 1][k] = max(dp[j][k], dp[j + 1][k])
                        if k - a[j] >= 0:
                            dp[j + 1][k] = max(dp[j + 1][k], dp[j][k - a[j]])
                if sum(dp[-1][max(0, K - A[ic]):K]) == 0:
                    cur = iupper
                else:
                    cur = ilower
            else:
                ic = ilower
                a = A[0:ic] + A[ic + 1:]
                dp = [[0] * (K + 1) for _ in range(N)]
                dp[0][0] = 1
                for j in range(N - 1):
                    for k in range(K + 1):
                        dp[j + 1][k] = max(dp[j][k], dp[j + 1][k])
                        if k - a[j] >= 0:
                            dp[j + 1][k] = max(dp[j + 1][k], dp[j][k - a[j]])
                if sum(dp[-1][max(0, K - A[ic]):K]) == 0:
                    cur = ilower
                else:
                    cur = -1
            break
#    print(cur)
    if cur==-1:
        ans = 0
    else:
        ans = bisect.bisect(A,A[cur])
    print(ans)


import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


### FIXED CODE ###

def examA():
    N = DI()/dec(7)
    ans = N
    print(N)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    N, K = LI()
    A = LI()
    A.sort()
    mask = (1 << K) - 1

    noneed = -1; need = N
    while(need-noneed>1):
        #print(noneed,need)
        i = (need+noneed)//2
        if A[i]>=K:
            is_need = True
        else:
            dp = 1
            for j in range(N):
                a = A[j]
                if a>K:
                    break
                if i == j:
                    continue
                dp |= ((dp << a) & mask)
            # print(dp,mask)

            is_need = (dp > mask>>A[i])

            # print(is_need,i)

        if is_need:
            need = i
        else:
            noneed = i

    ans = noneed + 1

    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""