#include <bits/stdc++.h>
using namespace std;
long long patterns(int a) {
  if (a == 0)
    return 1;
  else if (a == 1)
    return 1;
  else if (a == 2)
    return 2;
  else {
    return 2 * patterns(a - 2) + patterns(a - 3);
  }
}
int main() {
  int n, m, i;
  long ans = 1;
  cin >> n >> m;
  vector<int> a(m);
  for (i = 0; i < m; i++) {
    cin >> a.at(i);
  }
  for (i = 1; i < m; i++) {
    if (a.at(i - 1) + 1 == a.at(i)) {
      ans = 0;
    }
  }
  ans *= patterns(a.at(0) - 1);
  for (i = 1; i < m; i++) {
    ans *= patterns(a.at(i) - a.at(i - 1) - 2);
  }
  ans *= patterns(n - a.at(m - 1) - 1);
  cout << ans % 1000000007 << endl;
}
