#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace Modular
{
	const int mod = 1e9 + 7;

	template <typename T>
	T inverse(T a, T m) {
	  T u = 0, v = 1;
	  while (a != 0) {
		T t = m / a;
		m -= t * a; swap(a, m);
		u -= t * v; swap(u, v);
	  }
	  assert(m == 1);
	  return u;
	}

	class Mint
	{
	public:
		int value;
		
		Mint(){value = 0;};	
		Mint(int _n)
		{
			value = _n;
			if (value >= 0 && value < mod) return;
			value %= mod;
			if (value < 0) value += mod;
		}
		
		Mint& operator++(){ return *this += 1; }
		Mint& operator--(){ return *this -= 1; }
		Mint operator-() const { return Mint(-value); }
		
		Mint& operator+=(const Mint& other) 
		{
			if ((value += other.value) >= mod) value -= mod;
			return *this; 
		}
		
		Mint& operator-=(const Mint& other) 
		{
			if ((value -= other.value) < mod) value += mod;
			return *this; 
		}	
		
		Mint& operator*=(const Mint& other) 
		{
			value = (value * (LL) other.value) % mod;
			return *this; 
		}		
		
		Mint& operator/=(const Mint& other) 
		{
			return *this *= Mint(inverse(other.value, mod)); 
		}
		
		bool operator==(const Mint& other)
		{
			return value == other.value;
		}
		
		bool operator<(const Mint& other)
		{
			return value < other.value;
		}

		bool operator>(const Mint& other)
		{
			return value > other.value;
		}

		friend std::istream& operator>>(std::istream& stream, Mint& number)
		{
			int x;
			stream >> x;
			number = Mint(x);
			return stream;
		}
		
		friend std::ostream& operator<<(std::ostream& stream, Mint& number)
		{
			stream << number.value;
			return stream;
		}		
	};

	Mint operator+(const Mint& l, const Mint& r)
	{
		return Mint(l) += r;
	}
	
	Mint operator-(const Mint& l, const Mint& r)
	{
		return Mint(l) -= r;
	}
	
	Mint operator*(const Mint& l, const Mint& r)
	{
		return Mint(l) *= r;
	}
	
	Mint operator/(const Mint& l, const Mint& r)
	{
		return Mint(l) /= r;
	}
	
	template<typename T>
	Mint power(Mint& x, T y)
	{
		Mint res = 1;
		while(y)
		{
			if(y & 1) res *= x;
			x *= x;
			y >>= 1;
		}
		
		return res;
	}
};

using namespace Modular;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
		 int n, k;
  cin >> n >> k;
  vector<vector<Mint>> C(n + 1, vector<Mint>(n + 1));
  for (int i = 0; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
    }
  }
  vector<int> a(k);
  for (int i = 0; i < k; i++) {
    cin >> a[i];
  }
  vector<Mint> dp(n + 1, 0);
  dp[0] = 1;
  for (int i = 0; i < k; i++) {
    vector<Mint> new_dp(n + 1, 0);
    for (int j = 0; j <= n; j++) {
      for (int x = 0; x <= a[i] && j + x <= n; x++) {
        new_dp[j + x] += dp[j] * C[n - j][x] * C[n - x][a[i] - x];
      }
    }
    swap(dp, new_dp);
  }
  cout << dp[n] << '\n';
	
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 4224