#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int count(int start, int end, int *waysToEnd) {
  if (waysToEnd[start] >= 0) return waysToEnd[start];
  if (start > end) {
    waysToEnd[start] = 0;
  } else if (start == end) {
    waysToEnd[start] = 1;
  } else if (start == end - 1) {
    waysToEnd[start] = 1;
  } else {
    waysToEnd[start] =
        count(start + 1, end, waysToEnd) + count(start + 2, end, waysToEnd);
    ;
  }
  return waysToEnd[start];
}
int main(int argc, const char *argv[]) {
  int n, m = 0;
  cin >> n >> m;
  int *a = new int[m]();
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  vector<pair<int, int> > ranges;
  for (int i = 0; i <= m; i++) {
    pair<int, int> r;
    if (m == 0) {
      r.first = 0;
      r.second = n;
    } else if (i == 0) {
      r.first = 0;
      r.second = a[0] - 1;
    } else if (i == m) {
      r.first = a[m - 1] + 1;
      r.second = n;
    } else {
      r.first = a[i - 1] + 1;
      r.second = a[i] - 1;
    }
    ranges.push_back(r);
  }
  int maxRangeWidth = 0;
  for (pair<int, int> r : ranges) {
    int width = r.second - r.first + 1;
    if (maxRangeWidth < width) maxRangeWidth = width;
  }
  int *waysToEnd = new int[maxRangeWidth]();
  fill(waysToEnd, waysToEnd + maxRangeWidth, -1);
  count(0, maxRangeWidth - 1, waysToEnd);
  int *counts = new int[m + 1]();
  for (int i = 0; i <= m; i++) {
    pair<int, int> r = ranges[i];
    if (r.first == r.second) {
      counts[i] = 1;
    } else if (r.first > r.second) {
      counts[i] = 0;
    } else {
      counts[i] = waysToEnd[maxRangeWidth - 1 - (r.second - r.first)];
    }
  }
  unsigned long answer = 1;
  for (int i = 0; i <= m; i++) {
    answer *= (counts[i] % MOD);
    answer %= MOD;
  }
  cout << answer << endl;
  return 0;
}
