import Data.Maybe
import Data.Array
import Data.List
import qualified Data.ByteString.Char8 as C

parseInt :: C.ByteString -> Int
parseInt = fst . fromJust . C.readInt

m = 10^9 + 7
x @* y = x * y `mod` m
x @+ y = let z = x + y in if z >= m then z - m else z

fpm :: Int -> Int ->Int
fpm a e
  | e == 0 = 1
  | odd e = a' @* a' @* a
  | otherwise = a' @* a'
  where
  a' = fpm a (e `div` 2)

main :: IO ()
main = do
  [n, k] <- map parseInt . C.words <$> C.getLine
  let calc = foldl' (@+) 0
      f = array (1, k) [(i, fpm y n - calc [f ! (j * i) | j <- [2..y]]) | i <- reverse [1..k], let y = k `div` i]
  putStrLn $ show $ calc [f ! i @* i | i <- [1..k]]
