#include <bits/stdc++.h>
using namespace std;
template <typename Int>
inline Int read() {
  Int flag = 1;
  char c = getchar();
  while ((!isdigit(c)) && c != '-') c = getchar();
  if (c == '-') flag = -1, c = getchar();
  Int init = c & 15;
  while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
  return init * flag;
}
template <typename Int>
inline Int read(char &c) {
  Int flag = 1;
  c = getchar();
  while ((!isdigit(c)) && c != '-') c = getchar();
  if (c == '-') flag = -1, c = getchar();
  Int init = c & 15;
  while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
  return init * flag;
}
template <typename Int>
inline void write(Int x) {
  if (x < 0) putchar('-'), x = ~x + 1;
  if (x > 9) write(x / 10);
  putchar((x % 10) | 48);
}
template <typename Int>
inline void write(Int x, char nextch) {
  write(x);
  putchar(nextch);
}
int n, k;
int a[20 + 3];
int c[1007];
long long ans, tans;
void dfs(int u) {
  if (u > k) {
    tans = 1;
    for (int i = 1; i <= n; i++) tans = tans * c[i] % 1000000007;
    ans = (ans + tans) % 1000000007;
    return;
  }
  int t[1007];
  for (int i = 1; i <= n - a[u]; i++) t[i] = 0;
  for (int i = n - a[u] + 1; i <= n; i++) t[i] = 1;
  do {
    for (int i = 1; i <= n; i++) c[i] += t[i];
    dfs(u + 1);
    for (int i = 1; i <= n; i++) c[i] -= t[i];
  } while (next_permutation(t + 1, t + n + 1));
}
int main() {
  n = read<int>();
  k = read<int>();
  for (int i = 1; i <= k; i++) a[i] = read<int>();
  dfs(1);
  write(ans);
  return 0;
}
