fork download
  1. from scipy.special import comb, perm
  2. n,m=map(int,input().split())
  3. num = input().split(" ")
  4. ans=1;
  5. for i in range(0,m):
  6. ans*=comb(int(n),int(num[i]))
  7. ans%=10007
  8. n-=int(num[i])
  9. print(int(ans))
Success #stdin #stdout 0.27s 34320KB
stdin
5 2
3 1
stdout
20