#include #include #include using namespace std; typedef long long ll; #define mod 1000000007 ll mf[11111111]; ll fact(ll n){ if(mf[n]) return mf[n]; ll ret = 1; for(ll i = 1; i <= n; i++){ ret *= i; ret %= mod; } return mf[n] = ret; } ll inv(ll x,ll m){ ll ret = 1; ll k = x; for(ll i = m-2; i > 0; i>>=1){ if(i&1){ ret *= k; ret %= m; } k *= k; k %= m; } return ret; } int m; int k; int H[1111111]; int main(void){ scanf("%d",&m); int sum = 0; for(k = 0; scanf("%d",H+k)!=EOF; k++) sum += H[k]; if(sum == 0){ puts("1"); }else if(sum+k-1 > m){ puts("NA"); }else{ ll ans = 0; ll x = m-(sum+k-1); ans += fact(x+k)*inv(fact(x)*fact(k)%mod,mod)%mod; ans %= mod; printf("%lld\n",ans); } }