#include <bits/stdc++.h>
long long f[1000000];
long long fib(int a, int b, long long k) {
  if (a == 0) {
    return 0;
  } else if (a == b - 1) {
    return k;
  }
  f[0] = 1;
  k += f[b - 1];
  f[b] = k;
  b++;
  fib(a, b, k);
}
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  int a[m + 2];
  a[0] = 0, a[m + 1] = n;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
  }
  long long ans = 1;
  for (int i = 0; i <= m; i++) {
    int b = a[i + 1] - a[i] - 1;
    if (a[i + 1] == 1) {
      ans += 1;
      continue;
    }
    ans *= fib(b, 1, 0);
    if (ans >= 1000000007) {
      ans %= 1000000007;
    }
  }
  printf("%lld", ans);
  return 0;
}
