#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v;
long long cnt;
long long sum = 1;
int a = 0;
void dfs(int now, int end) {
  if (now == end) {
    cnt++;
    ;
  }
  if (now > end) {
    return;
  }
  dfs(now + 1, end);
  dfs(now + 2, end);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  for (int i = 0; i < m + 1; i++) {
    if (i == m) {
      dfs(v[i - 1] + 1, n);
    } else if (i == 0) {
      dfs(0, v[i] - 1);
    } else {
      dfs(v[i - 1] + 1, v[i] - 1);
    }
    sum *= cnt;
    sum %= 1000000007;
    cnt = 0;
  }
  cout << sum << endl;
}
