#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b;
  vector<int> v;
  vector<int> test;
  long long sum = 1;
  long long mod = 1e9 + 7;
  long long ans;
  cin >> a >> b;
  for (int i = 0; i < b; i++) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  v.push_back(a + 1);
  for (int i = 0; i < a - 1; i++) {
    int tmp = 2;
    for (int j = 0; j < v.size(); j++) {
      if ((i + 1) == v[j]) tmp--;
      if ((i + 2) == v[j]) tmp--;
      if (i == v[j]) {
        tmp = 1;
        break;
      }
    }
    test.push_back(tmp);
    sum *= tmp;
    while (sum > mod) {
      sum = sum - mod;
    }
  }
  sum = sum % mod;
  cout << sum << endl;
  return 0;
}
