#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 2e5 + 6;
int n, k;
long long dp[1001][20 * 1001];
long long go(int idx, int sum) {
  if (idx == n + 1) {
    if (sum == 0) return 1;
    return 0;
  }
  long long ret = dp[idx][sum];
  if (ret != -1) return dp[idx][sum];
  ret = 0;
  for (long long i = 1; i <= min(k, sum); i++) {
    long long trt = go(idx + 1, sum - i) % mod;
    trt *= i;
    ret = (ret + trt % mod) % mod;
  }
  return dp[idx][sum] = ret;
}
void solve() {
  cin >> n >> k;
  int sum = 0;
  for (int i = 1; i <= k; i++) {
    int x;
    cin >> x;
    sum += x;
  }
  memset(dp, -1, sizeof dp);
  cout << go(1, sum) << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
