#include<bits/stdc++.h> using namespace std; struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);cout<<fixed;cout<<setprecision(10);}}init; #define rep(i,n) for(auto i=(n)*0;i<n;i++) #define range(it,v) for(auto &it:v) typedef long long LL; const LL MOD=1e9+7; LL fact[2000000]; struct init2{ init2(){ fact[0]=1; rep(i,1500000)fact[i+1]=fact[i]*(i+1)%MOD; } }i2; // a x + b y = gcd(a, b) // O(log (a+b) ) LL extgcd(LL a, LL b, LL &x, LL &y) { LL g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; } // mを法とするaの逆元 // O(log a) LL invMod(LL a) { LL x, y; if (extgcd(a, MOD, x, y) == 1)return (x + MOD) % MOD; else return 0; // unsolvable } LL Comb(LL n,LL k){ LL u=fact[n]; LL d=(fact[k]*fact[n-k])%MOD; return (u*invMod(d))%MOD; } int main(){ LL M,rest; cin>>M; rest=M; int N=0; for(int num;cin>>num;N++){ rest-=num; } if(rest==M)cout<<1<<endl; else{ if(rest<N-1){ cout<<"NA"<<endl; } else{ rest-=N-1; cout<<Comb(N+rest,N)<<endl; } } return 0; }