#include <bits/stdc++.h>
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int a[m], total = 0;
  for (int i = 2; i < m; i++) {
    scanf("%d", &a[i]);
    if (a[i] > a[i - 2] + 2) total *= 2;
  }
  printf("%d", total);
  return 0;
}
