import qualified Data.Vector as V
main=print.solve.map read.words=<<getLine
solve[n,m]=foldr h 1$f 2 m where
  h k s=foldr(\i s->s*(n+k-i)`mod`mo*inv V.! i`mod`mo)s[1..k]
  inv=V.generate 30 $ \i->if i<2 then 1 else inv V.!(mo`mod`i)*(mo-mo`div`i)`mod`mo
f k i
  |i<2=[]
  |k*k>i=[1]
  |c/=0=c:f(k+1)j
  |otherwise=f(k+1)i
  where
    (j,c)=g i 0
    g i c=if r/=0 then(i,c)else g a(c+1)where(a,r)=divMod i k
mo=10^9+7::Int