#include <bits/stdc++.h>
int main() {
  int N, M;
  std::cin >> N >> M;
  std::vector<bool> a(M, true);
  for (int i = 0; i < M; ++i) {
    int num;
    std::cin >> num;
    a[num] = false;
  }
  std::vector<int> dp(N + 1);
  for (int i = 0; i <= N; ++i) {
    for (int j = i + 1; j <= std::min(i + 2, N); ++j)
      if (a[j]) dp[j] = dp[j - 1];
  }
  std::cout << dp[N] << std::endl;
  return 0;
}
