#include using namespace std; #define rep(i,a,b) for(int i=a;iN_) return 0; return factr[C_] * fact[N_] % mo*factr[N_ - C_] % mo; } //----------------------------------------------------------------- ll nHk(ll n, ll k) { return combi(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; } //cout << a << endl; //cout << b << endl; ll ans = nHk(a, b); cout << ans << endl; }