#include <iostream>
using ll = long long;
using namespace std;
ll dp[101][10001], n, m,temp,sum;
ll C(int down, int up) {
if (up == 0) return 1;
ll u = 1, d = 1;
for (int i = 0; i < up; i++) u *= down--;
for (int j = up; j > 0; j--) d *= j;
return u / d;
}
int main()
{
cin >> n >> m;
for (int j = 0; j <= n; j++) dp[0][j] = 1;
for (int i = 1; i <= m; i++) {
cin >> temp;
sum += temp;
for (int j = 0; j <= n; j++) {
if (j < sum) dp[i][j] = 0;
else dp[i][j] = dp[i - 1][j] * C(j-sum+temp,temp);
}
}
cout << dp[m][n] << endl;
return 0;
}