import Control.Monad

main = do
    [n, wmax] <- map read . words <$> getLine
    wvs <- map (map read . words) <$> replicateM n getLine
    print $ maximum $ map last $ filter ([wmax + 1, -1] >=) $ map subSum $ subs wvs

subs [] = [[]]
subs (x:xs) = subs xs ++ map (x:) (subs xs)

subSum = foldr (zipWith (+)) [0, 0]