import Data.Int

main = getLine >>= print . solve 1 . map (read :: String -> Int64) . words

solve :: Int64 -> [Int64] -> Int64
solve ans [_, 0] = ans
solve ans [n, m] = solve (ans * n `mod` 1000000007) [n, m - 1]