require "openssl" main = -> { MOD = 10**8 M = gets.to_i N = gets.to_i p = 1 N.times do |i| p *= M - i p /= i + 1 p %= MOD end puts "%08d" % p } main.call