#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 1;
const long long MOD = 1e9 + 7;
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  return b ? gcd(b, a % b) : a;
}
int s2i(string num) {
  stringstream ss;
  ss << num << flush;
  int n;
  ss >> n;
  return n;
}
string i2s(int n) {
  stringstream ss;
  ss << n << flush;
  return ss.str();
}
bool firstCompare(const pair<int, int>& firstElof,
                  const pair<int, int>& secondElof) {
  return firstElof.first < secondElof.first;
}
bool secondCompare(const pair<int, int>& firstElof,
                   const pair<int, int>& secondElof) {
  return firstElof.second < secondElof.second;
}
long long N, M;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> M;
  vector<long long> a(M);
  for (long long i = 0; i < M; i++) cin >> a[i];
  long long ans = 1;
  long long tmp = 0;
  for (long long i = 0; i < M + 1; i++) {
    long long sub;
    if (i < M)
      sub = a[i] - 1 - tmp;
    else
      sub = N - tmp;
    ans *= (sub / 2 + 1);
    if ((i < M - 1) && (a[i + 1] == a[i] + 1)) {
      ans = 0;
      break;
    }
    tmp = a[i] + 1;
  }
  cout << ans << '\n';
}
