import Control.Arrow import Control.Monad import qualified Data.ByteString.Char8 as BSC8 import qualified Data.Vector.Unboxed as VU import qualified Data.Vector.Unboxed.Mutable as VUM main :: IO () main = do (n, k) <- parse2 solver n k >>= print . VU.length . VU.filter (>=k) solver :: Int -> Int -> IO (VU.Vector Int) solver n k = do table <- VU.unsafeThaw $ VU.replicate (n + 1) (0 :: Int) forM_ [2..n] $ \i -> do x <- VUM.read table i when (x == 0) $ do VUM.write table i 1 forM_ [2 * i, 3 * i .. n] $ \j -> VUM.unsafeModify table (+1) j VU.unsafeFreeze table type Parser a = BSC8.ByteString -> Maybe (a, BSC8.ByteString) parseInt :: Parser Int parseInt = fmap (second BSC8.tail) . BSC8.readInt parse2 :: IO (Int, Int) parse2 = (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 parseInt <$> BSC8.getLine