
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N, M;
set<int>A;

int main(void)
{
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int a;
		cin >> a;
		A.insert(a);
	}
	vector<pair<bool, int>>X;
	for (int i = 0; i < N; ++i) {
		X.push_back(make_pair(!A.count(i), i));
	}
	int ans = 0;
	while (X.size() > 1) {
		vector<pair<bool, int>>nX;
		for (int i = 0; i < X.size() / 2; ++i) {
			int u = i * 2;
			int v = u + 1;
			nX.push_back(max(X[u], X[v]));
			ans += (X[u].first && X[v].first) ? 1 : 0;
		}
		X = nX;
	}
	cout << ans << endl;
	return 0;
}

