#include <bits/stdc++.h>
using namespace std;
int dan(int d) {
  int a1 = 1;
  int a2 = 2;
  int sd = 0;
  if (d <= 0)
    return 1;
  else if (d == 1)
    return 1;
  else if (d == 2)
    return 2;
  else {
    for (int i = 1; i <= d - 2; i++) {
      sd = a2 + a1;
      a1 = a2;
      a2 = sd;
    }
    return sd;
  }
}
int main() {
  int n, m;
  int am[100000] = {0};
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> am[i];
  int flag = 0;
  int dm[100000] = {0};
  for (int i = 1; i < m; i++) {
    if (am[i] - am[i - 1] == 1) {
      flag = 1;
      break;
    } else {
      dm[i] = am[i] - am[i - 1] - 2;
    }
  }
  dm[0] = am[0] - 1;
  dm[m] = n - am[m - 1] - 1;
  long long sum = 1;
  for (int i = 0; i <= m; i++) {
    sum *= dan(dm[i]);
    sum = sum % 1000000007LL;
  }
  if (flag) {
    cout << 0 << endl;
  } else {
    cout << sum % 1000000007LL << endl;
  }
}
