import Data.Array

solve :: Int -> Int -> Mint
solve n k = sum $ map (\(i,a) -> M i*a) $ assocs arr where
  arr = array (1, k) [ (i, M (div k i) ^ n - sum ext) |
    i <- [k, k-1 .. 1],
    let ext = [arr!(i*m) | m <- [2..div k i] ] ]

main = do
  [n, k] <- map read.words <$> getLine
  print $ solve n k

modulus = 10^9 + 7
newtype Mint = M Int
instance Num Mint where
  (M a) + (M b)
    | a + b < modulus = M $ a + b
    | otherwise = M $ a + b - modulus
  (M a) * (M b) = M $ mod (a * b) modulus
  negate (M 0) = M 0
  negate (M a) = M $ modulus - a
  fromInteger a = M $ mod (fromInteger a) modulus
  abs = id
  signum _ = M 1
instance Show Mint where
  show (M a) = show a

fastSum :: [Mint] -> Mint
fastSum = M . (`mod` modulus) . sum . map (\(M a) -> a)