{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE BangPatterns #-} import Control.Applicative import Control.Monad import Control.Arrow import Data.List import Data.Maybe import Data.Char import Text.Printf readInt = ( readLn :: IO Int ) getInts = map ( read :: String -> Int ) . words <$> getLine which a b f = if f then a else b mp [ a, b ] = ( a, b ) main = do [ n, m ] <- getInts cs <- sort <$> getInts print $ f m cs f m (c:cs) | m == c = 1 | m < c = 0 | otherwise = 1 + f ( m - c ) cs