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
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] and j + a[i] < k then
      tail[i][j + a[i]] = true
    end
  end
  curmax = mma(curmax + a[i], k - 1)
  tail[i][a[i]] = true
end
local head = {}
for i = 1, k - 1 do
  head[i] = false
end
local cnt = 0
local 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
print(cnt)
