#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define SIZE 100000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i%mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
ll dp[22][2111];
int main()
{
	int num, kai;
	scanf("%d%d", &num, &kai);
	invinit();
	dp[0][0] = 1;
	for (int i = 0; i < kai; i++)
	{
		int z;
		scanf("%d", &z);
		for (int j = 0; j <= num; j++)
		{
			for (int k = 0; k <= z; k++)
			{
				dp[i + 1][j + k] = (dp[i + 1][j + k] + dp[i][j] * com(num - j, k) % mod*com(num - k, z - k)) % mod;
			}
		}
	}
	printf("%lld\n", dp[kai][num]);
}