#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m + 2);
  a[0] = -1;
  for (int i = 0; i < (m); i++) cin >> a[i + 1];
  a[m + 1] = n + 1;
  long long count = 1;
  for (int i = 0; i < (m + 1); i++) {
    int diff = a[i + 1] - a[i];
    if (diff == 1) {
      cout << 0 << endl;
      return 0;
    }
    if (diff == 2) count *= 1;
    if (diff == 3) count *= 1;
    if (diff == 4) count = count * 2 % mod;
    if (diff >= 5) {
      long long ans = 0;
      long long ans_a = 1;
      long long ans_b = 2;
      int check = 0;
      while (check <= diff - 5) {
        if (ans_a > ans_b)
          ans_b = (ans_b + ans_a) % mod;
        else
          ans_a = (ans_a + ans_b) % mod;
        check += 1;
      }
      ans = max(ans_a, ans_b);
      count = count * ans % mod;
    }
  }
  cout << count << endl;
  return 0;
}
