#include <bits/stdc++.h>
using namespace std;
const int dr[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dc[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int px[] = {1, 0, -1, 0};
const int py[] = {0, 1, 0, -1};
const int INF = 1 << 29;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) {
  int res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
template <class T>
void chmax(T &a, const T &b) {
  a = max(a, b);
}
template <class T>
void chmin(T &a, const T &b) {
  a = min(a, b);
}
template <typename T>
string to_str(T str) {
  stringstream stream;
  stream << str;
  return stream.str();
}
template <typename T>
int to_int(T num) {
  int val;
  stringstream stream;
  stream << num;
  stream >> val;
  return val;
}
vector<string> split(const string &s, char delim) {
  vector<string> elems;
  stringstream ss(s);
  string item;
  while (getline(ss, item, delim)) elems.push_back(item);
  return elems;
}
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long power(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
int n, m;
long long nCr[1001][1001], ans = 1, pow2[1001], arr[1001];
int main() {
  cin >> n >> m;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i)
        nCr[i][j] = 1;
      else
        nCr[i][j] = (nCr[i - 1][j - 1] + nCr[i - 1][j]) % 1000000007;
    }
  pow2[0] = 1, pow2[1] = 1;
  for (int i = 2; i <= n; i++) pow2[i] = (pow2[i - 1] * 2) % 1000000007;
  for (int i = 0; i < (m); i++) cin >> arr[i];
  sort(arr, arr + m);
  long long cnt = 0, tmp;
  for (int i = 0; i < m; i++) {
    if (i == 0)
      tmp = arr[i] - 1;
    else {
      tmp = arr[i] - arr[i - 1] - 1;
      ans = (ans * pow2[tmp]) % 1000000007;
    }
    cnt += tmp;
    ans = (ans * nCr[cnt][tmp]) % 1000000007;
  }
  cnt += n - arr[m - 1];
  ans = ans * nCr[cnt][n - arr[m - 1]] % 1000000007;
  cout << ans << endl;
  return 0;
}
