#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long b) {
  long long r = 1LL;
  while (b) {
    if (b & 1LL) r *= a;
    if (r >= 1000000007) r %= 1000000007;
    a *= a;
    if (a >= 1000000007) a %= 1000000007;
    b >>= 1LL;
  }
  return r % 1000000007;
}
long long fact[100100];
long long rfact[100100];
long long d[22];
int main() {
  memset((fact), (0), sizeof(fact));
  fact[0] = 1;
  for (long long i = (1); i < (100100); ++i) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= 1000000007;
  }
  memset((rfact), (0), sizeof(rfact));
  rfact[0] = 1;
  for (long long i = (1); i < (100100); ++i) {
    rfact[i] = rfact[i - 1] * modpow(i, 1000000007 - 2);
    rfact[i] %= 1000000007;
  }
  memset((d), (0), sizeof(d));
  long long n, k;
  cin >> n >> k;
  vector<long long> v;
  for (long long i = (0); i < (k); ++i) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  for (long long i = (0); i < (1 << k); ++i) {
    long long a = 1;
    long long c = 0;
    for (long long j = (0); j < (k); ++j) {
      long long p;
      if (((i >> j) & 1) == 1) {
        c++;
        p = v[j];
      } else {
        p = n - v[j];
      }
      a *= p * modpow(n, 1000000007 - 2) % 1000000007;
      a %= 1000000007;
    }
    d[c] += a;
  }
  long long ans = 0;
  for (long long i = (0); i < (k + 1); ++i) {
    ans += modpow(i, n * d[i] % 1000000007);
    ans %= 1000000007;
  }
  cout << (ans * k) % 1000000007 << endl;
  return 0;
}
