#include <bits/stdc++.h>
using namespace std;
const int modl = 1000000007;
int n, m;
int a[1010];
int p2[1010];
int c[1010][1010];
int gcd(int a, int b) {
  if (a == 0 || b == 0)
    return a + b;
  else
    return gcd(b, a % b);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  sort(a + 1, a + 1 + m);
  a[0] = 0;
  a[m + 1] = n + 1;
  p2[0] = 1;
  for (int i = 1; i <= n; i++) p2[i] = (p2[i - 1] * 2) % modl;
  long long ret = 1;
  for (int i = 2; i <= m; i++)
    if (a[i] > a[i - 1] + 1) ret = (ret * p2[a[i] - a[i - 1] - 2]) % modl;
  c[0][0] = 1;
  for (int i = 1; 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]) % modl;
  }
  for (int i = 0, total = n - m; i <= m; i++) {
    ret = (ret * c[total][a[i + 1] - a[i] - 1]) % modl;
    total -= a[i + 1] - a[i] - 1;
  }
  cout << ret << endl;
  return 0;
}
