#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1000000000000000;
const long long inf = -1e18;
long long ma = 1000000000 + 7;
long long mx = 1000003;
long long h, w, n, m, x;
string s, t;
char maze[60][60];
int dis[101][101];
int graph[52][52];
bool vis[52];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
long long gcd(long long x, long long y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
void comb(vector<vector<long long> >& v) {
  for (long long i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (long long k = 1; k < v.size(); k++) {
    for (int j = 1; j < k; j++) {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
    }
  }
}
int main() {
  cin >> n >> m;
  vector<long long> aa(m);
  for (long long i = 0; i < m; i++) {
    cin >> aa[i];
  }
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (m >= 2) {
    for (long long i = 0; i < m - 1; i++) {
      if (aa[i + 1] - aa[i] == 1) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  long long res = 1;
  long long pre = 0;
  for (long long i = 0; i < m + 1; i++) {
    long long pp = 0;
    if (i == m) {
      pp = n - pre;
    } else {
      pp = aa[i] - pre - 1;
    }
    long long p2 = pp / 2;
    long long p1 = pp % 2;
    long long pat = 0;
    for (; p2 >= 0; p2--, p1 += 2) {
      vector<vector<long long> > v(p2 + p1 + 1,
                                   vector<long long>(p2 + p1 + 1, 0));
      comb(v);
      pat += v[p2 + p1][min(p1, p2)] % 1000000007;
      pat %= 1000000007;
    }
    res *= pat % 1000000007;
    res %= 1000000007;
    if (i == m) break;
    pre = aa[i] + 1;
  }
  cout << res << endl;
}
