#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
template <typename T>
T getSum(T array[], int length) {
  T sum = 0;
  for (int i = 0; i < length; i++) {
    sum += array[i];
  }
  return sum;
}
string ToString(int i) {
  char buffer[1000];
  sprintf(buffer, "%d", i);
  return string(buffer);
}
string convertToN(long n, int base) {
  string ans = "";
  while (n != 0) {
    int temp = n % base;
    ans = ToString(temp) + ans;
    n /= base;
  }
  return ans;
}
template <typename T>
bool containsKey(map<string, T> map, string key) {
  if (map.count(key) == 0) {
    return false;
  }
  return true;
}
bool isPrime(long long num) {
  if (num <= 1) {
    return false;
  }
  for (int i = 2; i < num / 2 + 1; i++) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}
bool question(long long middle) { return false; }
long long binarySearch(long long left, long long right) {
  while (right - left > 1) {
    long long middle = (right + left) / 2;
    if (question(middle)) {
      left = middle;
    } else {
      right = middle;
    }
  }
  return left;
}
bool is_match(int array[], int size, int idx) {
  for (long long(i) = 0; (i) < (size); (i)++) {
    if (array[i] == idx) {
      return true;
    }
  }
  return false;
}
int main() {
  int N, M;
  cin >> N >> M;
  int a[M];
  for (long long(i) = 0; (i) < (M); (i)++) {
    cin >> a[i];
  }
  long long dp[N];
  for (long long(i) = 0; (i) < (N - 1); (i)++) {
    if (is_match(a, M, i)) dp[i + 1] = dp[i] + 1;
    if (i + 2 < N) {
      if (is_match(a, M, i)) dp[i + 2] = dp[i] + 1;
    }
  }
  cout << dp[N - 1] << endl;
  ;
}
