#include <bits/stdc++.h>
using namespace std;
long long int solve(long long int start, long long int end) {
  if (start >= end) return 0;
  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);
  return ans;
}
int main(int argc, char const *argv[]) {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> v(m), a(m, 0), b(m, 0);
  long long int sum1 = 0, sum2 = 0;
  for (long long int i = 0; i < m; i++) {
    cin >> v[i];
  }
  long long int ans = 1;
  if (v[0] == 1) {
  } else {
    ans *= solve(0, v[0] - 1);
  }
  for (long long int i = 0; i < m - 1; i++) {
    ans *= solve(v[i] + 1, v[i + 1] - 1);
  }
  ans *= solve(v[m - 1] + 1, n);
  cout << ans % 1000000007 << endl;
}
