#include <bits/stdc++.h>
using namespace std;
long long int arr[1000000];
long long int solve(long long int start, long long int end) {
  if (start >= end) return 0;
  if (arr[end - start] != 0) {
    return arr[end - start];
  }
  if (end - start == 1) return 1;
  if (end - start == 2) return 2;
  long long int ans = 0;
  ans += solve(start + 1, end);
  ans += solve(start + 2, end);
  arr[end - start] = ans;
  return ans;
}
int main(int argc, char const *argv[]) {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> v, a(m, 0), b(m, 0);
  long long int sum1 = 0, sum2 = 0;
  for (long long int i = 0; i < m; i++) {
    long long int temp;
    cin >> temp;
    if (!v.empty()) {
      if (v.back() != temp) {
        v.push_back(temp);
      }
    } else {
      v.push_back(temp);
    }
  }
  long long int ans = 1;
  if (m == 0) {
    ans *= solve(0, n);
  } else {
    if (v[0] == 1) {
    } else {
      ans *= solve(0, v[0] - 1);
    }
    for (long long int i = 0; i < v.size() - 1; i++) {
      ans *= solve(v[i] + 1, v[i + 1] - 1);
    }
    ans *= solve(v.back() + 1, n);
  }
  cout << ans % 1000000007 << endl;
}
