import Control.Monad.State (State, evalState, gets, modify)
import Data.Map (Map, lookup, insert, empty)
import Data.Maybe (maybe)
import Data.List
main = getLine >>= main' . fmap read . words
    where
        main' [n, k] = getLine >>= print . solve n k . sort . fmap read . words

solve ::  Int -> Int -> [Int] -> Int
solve n k as = count $ splitAt (n `div` 2) xs
    where
        xs = zip [0..] as

        count (ys, z : zs)
            | run (check z xs) (0, 0) = count $ splitAt (length ys `div` 2) ys
            | otherwise = length ys + 1 + count (splitAt (length zs `div` 2) zs)
        count ([], _) = 0
        count (ys, _) = count $ splitAt (length ys `div` 2) ys

        check (xn, a) ((yn, ya) : rs) = memoize check'
            where
                check' (nk, i)
                    | yn == xn = check (xn, a) rs (nk, i + 1)
                    | nk < k - a = (||) <$> check (xn, a) rs (nk, i + 1) <*> check (xn, a) rs (nk + ya, i + 1)
                    | otherwise = return $ nk < k
        check (_, a) _ = \(nk, _) -> return $ k - a <= nk && nk < k


type Memoizer a b = a -> State (Map a b) b

run :: Memoizer a b -> a -> b
run f = flip evalState empty . f

memoize :: (Ord a) => Memoizer a b -> Memoizer a b
memoize f x = gets (Data.Map.lookup x) >>= maybe (f x >>= ((<$) <*> (modify . Data.Map.insert x))) return
