#include <bits/stdc++.h>
using namespace std;
vector<vector<long> kaij(100000,vector<long>(2));
long Combination(int n, int r)
{

    if (n - r < r) r = n - r;
    if (r == 0) return 1;
    if (r == 1) return n;

    vector<int> numerator(r);
  vector<int> denominator(r);

    for (int k = 0; k < r; k++)
    {
        numerator[k] = n - r + k + 1;
        denominator[k] = k + 1;
    }

    for (int p = 2; p <= r; p++)
    {
        int pivot = denominator[p - 1];
        if (pivot > 1)
        {
            int offset = (n - r) % p;
            for (int k = p - 1; k < r; k += p)
            {
                numerator[k - offset] /= pivot;
                denominator[k] /= pivot;
            }
        }
    }

    long result = 1;
    for (int k = 0; k < r; k++)
    {
        if (numerator[k] > 1) result *= numerator[k];
    }

    return result;
}

long kai(long n,long r){
  if(kaij[n][r] != 0)return kaij[n][r];
  kaij[n][r] = Combination(n,r);
  return kaij[n][r];
}
int main() {
  int n,m;
  cin >> n >> m;
  vector<long long> a(m);
  long long i,j;
  long long ans = 1;
  long long tmp=0;
  //vector<vector<long long int> > v(n+1,vector<long long int>(n+1,0));
  //comb(v);
  if(m==0){
    for(j=0;j<(n/2)+1;j++){
      tmp += kai(n-j,n - j*2);
    }
    cout << tmp << endl;
    return 0;
  }
  for(i=0;i<m;i++){
    cin >> a[i];
  }
  vector<long long> b(m+1);
  for(i=1;i<m;i++){
    b[i] = a[i] - a[i-1] - 2;
  }
  b[0] = a[0] - 1;
  b[m] = n -1 - a[m-1];

  for(i=0;i<m+1;i++){
    if(b[i] == -1){
      ans = 0;
      break;
    }else if(b[i] == -2){
      continue;
    }
    for(j=0;j<(b[i]/2)+1;j++){
      tmp += kai(b[i]-j,b[i] - j*2);
    }
    ans *= tmp;
    if (ans > 1000000007)ans %= 1000000007;
    tmp = 0;
  }
  cout << ans << endl;
}