from math import factorial
from numpy import prod
def probab(n,a):
    return factorial(n)/(factorial(a)*factorial(n-a))
N,K = map(int,input().split())
ListNum = list(map(int,input().split()))
num = sum(ListNum)
List = [num//N]*N
while(sum(List)<=num):
    index = List.index(min(List))
    List[index]+=1
    num-=1
print((prod(List)*prod(list(probab(N,i) for i in ListNum)))%(10**9 +7))
