#include using namespace std; #define rep(i,a,b) for(int i=a;i>= 1; return r; } ll moddiv(ll a, ll b) { ll ap_2 = modpow(b, mo - 2); return (a * ap_2) % mo; } ll aCb(ll a, ll b) { return moddiv(modfact(a), (modfact(a-b) * modfact(b))%mo); } ll nHk(ll n, ll k) { return aCb(n + k - 1, k - 1); } //----------------------------------------------------------------- int M; vector H; //----------------------------------------------------------------- int main() { cin >> M; int x; while (cin >> x) H.push_back(x); if (H.size() == 1 && H[0] == 0) { printf("1\n"); return 0; } int sum = 0; rep(i, 0, H.size()) sum += H[i]; int a = M - sum - (H.size() - 1); int b = H.size() + 1; if (a < 0) { cout << "NA" << endl; return 0; } ll ans = nHk(a, b); cout << ans << endl; }