#include <bits/stdc++.h>
int main(void) {
  int n;
  int m;
  int bs[100000];
  int i, j;
  int ways1;
  int ways2;
  int ans;
  int x[1000];
  int aida[1000];
  x[0] = 1;
  x[1] = 2;
  for (i = 0; i < 100; i++) {
    x[n + 2] = x[n + 1] + x[n];
  }
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &bs[i]);
  }
  for (i = 0; i < m; i++) {
    if (bs[i + 1] == bs[i] + 1) {
      ways2 = 0;
      break;
    } else if (bs[i] == bs[i - 1]) {
      aida[i] = 1;
    } else if (bs[i] - bs[i - 1] == 2) {
      aida[i] = 1;
    } else if (bs[i] - bs[i - 1] == 3) {
      aida[i] = 1;
    } else {
      if (i == 0) {
        j = bs[0] - 1;
      } else {
        j = bs[i] - bs[i - 1] - 2;
      }
      aida[i] = x[j - 1];
    }
  }
  ways1 = 1;
  for (i = 0; i < m; i++) {
    ways1 = ways1 * aida[i];
  }
  if (ways2 == 0) {
    ans = ways2;
  } else {
    ans = ways1;
  }
  ans = ways1 % 1000000007;
  printf("%d", ans);
  return 0;
}
