#include <bits/stdc++.h>
using namespace std;
long long int dp[12000][12000];
long long int nCr(int n, int r) {
  if (n == r) return dp[n][r] = 1;
  if (r == 0) return dp[n][r] = 1;
  if (r == 1) return dp[n][r] = n;
  if (dp[n][r]) return dp[n][r];
  return dp[n][r] = nCr(n - 1, r) + nCr(n - 1, r - 1);
}
int main() {
  long long int ans = 1, cnt;
  int N, M, i, j, k, flag = 0, diff;
  cin >> N >> M;
  int a[M];
  long long int tmp[M + 10];
  for (i = 0; i < M; i++) cin >> a[i];
  if (M >= 2) {
    for (i = 0; i < M - 1; i++) {
      if (a[i + 1] - a[i] == 1) flag = 1;
    }
  }
  if (flag == 1)
    ans = 0;
  else {
    if (M >= 2) {
      diff = a[0] - 1;
      cnt = 0;
      for (j = 0; j * 2 <= diff; j++) {
        k = diff - j * 2;
        cnt += nCr(j + k, j);
      }
      tmp[0] = cnt;
      for (i = 1; i < M; i++) {
        diff = a[i] - a[i - 1] - 2;
        cnt = 0;
        for (j = 0; j * 2 <= diff; j++) {
          k = diff - j * 2;
          cnt += nCr(j + k, j);
        }
        tmp[i] = cnt;
      }
      diff = N - a[M - 1] - 1;
      cnt = 0;
      for (j = 0; j * 2 <= diff; j++) {
        k = diff - j * 2;
        cnt += nCr(j + k, j);
      }
      tmp[M] = cnt;
      for (i = 0; i <= M; i++) {
        ans = (ans * tmp[i]) % 1000000007;
      }
    } else {
      diff = a[0] - 1;
      cnt = 0;
      for (j = 0; j * 2 <= diff; j++) {
        k = diff - j * 2;
        cnt += nCr(j + k, j);
      }
      tmp[0] = cnt;
      diff = N - a[M - 1] - 1;
      cnt = 0;
      for (j = 0; j * 2 <= diff; j++) {
        k = diff - j * 2;
        cnt += nCr(j + k, j);
      }
      tmp[1] = cnt;
      for (i = 0; i <= 1; i++) {
        ans = (ans * tmp[i]) % 1000000007;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
