import Data.Array.Unboxed (UArray, accumArray, elems) import Control.Applicative ((<$>)) -- | Generates the sequence of prime numbers. -- Based on . primes2 :: Integral a => [a] primes2 = map fromIntegral primes2' where primes2' = [2, 3, 5] ++ sieve2 5 7 (drop 2 primes2') sieve2 m s (p : ps) = [n | n <- ns, gcd m n == 1] ++ sieve2 (m * p) (p * p) ps where ns = [x + y | x <- [s, s + 6 .. p * p - 2], y <- [0, 4]] primesTo :: Int -> [Int] primesTo n = takeWhile (<= n) primes2 count :: Int -> Int -> Int count n k = length $ filter (>= k) $ elems tb where tb = accumArray (+) 0 (2, n) [(p * i, 1) | p <- primesTo n, i <- [1 .. div n p]] :: UArray Int Int main :: IO () main = do [n, k] <- map read . words <$> getLine print $ count n k