#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;
int x_pos[4] = {1, 0, -1, 0}, y_pos[4] = {0, 1, 0, -1};
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
char upper(char c) { return c - 0x20; }
char lower(char c) { return c + 0x20; }
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int n, m;
long long ans = 0;
vector<int> a;
void bfs(int now, int b) {
  if (now == b - 1) {
    ans++;
    return;
  }
  if (now > n) return;
  bfs(now + 1, b);
  if (now + 2 != b) {
    bfs(now + 2, b);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < (m); ++i) {
    int b;
    cin >> b;
    a.push_back(b);
  }
  a.push_back(n + 1);
  vector<long long> v;
  for (int i = 0; i < (m + 1); ++i) {
    if (i == 0) {
      bfs(0, a[i]);
    } else {
      bfs(a[i - 1] + 1, a[i]);
    }
    v.push_back(ans);
    ans = 0;
  }
  long long anss = 1;
  for (int i = 0; i < (v.size()); ++i) {
    anss = ((anss % MOD) * (v[i] % MOD)) % MOD;
  }
  cout << anss << endl;
}
