#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; ++i) cin >> a[i];
  vector<int> itv(m + 1);
  itv[0] = a[0];
  int ans = 0;
  int i;
  bool flag = true;
  for (i = 1; i < m; i++) itv[i] = a[i] - a[i - 1] - 1;
  itv[m] = n - a[m - 1];
  for (int i = 0; i < m + 1; ++i)
    if (itv[i] == 0) flag = false;
  for (int i = 0; i < m + 1; ++i) {
    if (itv[i] % 2 == 0) {
      ans += itv[i] / 2 + 1;
    } else {
      ans += (itv[i] - 1) / 2 + 1;
    }
  }
  if (flag) {
    cout << ans << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}
