MOD = 10 ** 9 + 7 modinv = lambda a, mod=MOD: pow(a, -1, mod) def comb(N, K, mod=MOD): ret = 1 for i in range(K): ret = ret * (N - i) * modinv(1 + i) % mod return ret M = int(input()) H = list(map(int, input().split())) if H == [0]: print(1) exit() L = len(H) W = M - sum(H) if W < L - 1: print('NA') exit() print(comb(W + 1, L) % MOD)