#include <bits/stdc++.h>
using namespace std;
long long pattern(long long x) {
  if (x == 1 || x == 2) {
    return 1;
  } else {
    long long b, bb, nex;
    bb = 1;
    b = 1;
    for (long long i = 3; i <= x; i++) {
      nex = bb + b;
      if (nex >= 1000000007) {
        nex = nex % 1000000007;
      }
      bb = b;
      b = nex;
    }
    return b;
  }
}
int main() {
  long long N, M, check, ans;
  vector<long long> a;
  cin >> N >> M;
  for (long long(i) = 0; (i) < (M); (i)++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  check = 0;
  for (long long(i) = 0; (i) < (M - 1); (i)++) {
    if (a[i + 1] == a[i] + 1) {
      check = 1;
    }
  }
  if (check == 1) {
    cout << 0 << endl;
  }
  if (check == 0) {
    ans = pattern(a[0]);
    a.push_back(N + 1);
    for (long long(i) = 0; (i) < (M); (i)++) {
      ans = ans * pattern(a[i + 1] - a[i] - 1);
      if (ans >= 1000000007) {
        ans = ans % 1000000007;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
