import Control.Applicative import Data.List main :: IO () main = solve <$> map read <$> words <$> getLine >>= print solve :: [Int] -> Int solve [n, l] = foldl' f 0 $ takeWhile ((<=l).(* (n-1))) ps where f ct p = ct + l - (n-1) * p + 1 ps :: [Int] ps = 2 : unfoldr f 3 where f x | isP x = Just (x, x+2) | otherwise = f (x+2) isP :: Int -> Bool isP x = all ((/=0).(mod x)) . takeWhile ((<=x).(^2)) $ ps