#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int a[100000];
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = 1; i <= m - 1; i++) {
    if (a[i] + 1 == a[i + 1]) {
      printf("0\n");
      return 0;
    }
  }
  int p_up[100000];
  p_up[1] = a[1] - 1;
  for (int i = 2; i <= m; i++) p_up[i] = a[i] - a[i - 1] - 2;
  p_up[m + 1] = n - a[m] - 1;
  int p_up_max = 0;
  for (int i = 1; i <= m + 1; i++)
    if (p_up_max < p_up[i]) p_up_max = p_up[i];
  long long up_ways[100000];
  up_ways[0] = 1;
  up_ways[1] = 1;
  up_ways[2] = 2;
  for (int i = 3; i <= p_up_max; i++)
    up_ways[i] = up_ways[i - 1] + up_ways[i - 2];
  long long ans = 1;
  for (int i = 1; i <= m + 1; i++) ans *= up_ways[p_up[i]];
  cout << ans % 1000000007 << endl;
  return 0;
}
