local mmi = math.min
local mma = math.max
local n, k = io.read("*n", "*n")
local a = {}
for i = 1, n do
  local at = io.read("*n")
  if at < k then
    table.insert(a, at)
  end
end
n = #a
table.sort(a, function(x, y) return x > y end)
local function solve()
  if n == 0 then return 0 end
  local tail = {}
  for i = 1, n do
    tail[i] = {}
    -- for j = 1, k - 1 do
    --   tail[i][j] = false
    -- end
  end
  tail[n][a[n]] = true
  local curmax = a[n]
  for i = n - 1, 1, -1 do
    for j = 1, curmax do
      if tail[i + 1][j] then
        tail[i][j] = true
        if j + a[i] < k then
          tail[i][j + a[i]] = true
          curmax = mmi(curmax, j + a[i])
        end
      end
    end
    tail[i][a[i]] = true
    curmax = mmi(curmax, a[i])
  end
  local head = {}
  for i = 1, k - 1 do
    head[i] = false
  end
  local cnt = 0
  curmax = 0
  for i = 1, n - 1 do
    local ai = a[i]
    local need = false
    for j = k - ai, k - 1 do
      for p = 1, j - 1 do
        local q = j - p
        if head[p] and tail[i + 1][q] then
          need = true
          break
        end
      end
      if head[j] or tail[i + 1][j] then
        need = true
      end
      if need then break end
    end
    if not need then cnt = cnt + 1 end
    for j = mmi(curmax, k - 1 - ai), 1, -1 do
      if head[j] then head[j + ai] = true end
    end
    head[ai] = true
    curmax = mmi(curmax + ai, k - 1)
  end
  do -- i == n
    local ai = a[n]
    local need = false
    for j = k - ai, k - 1 do
      if head[j] then
        need = true
        break
      end
    end
    if not need then cnt = cnt + 1 end
  end
  return cnt
end
print(solve())
