#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

bool a[100000];
int n, m, cnt = 0;

int dfs(int k) {
	if (k >= n - 1) {
		if (a[k - n + 1])return -1;
		return k - n + 1;
	}
	int l = dfs(k * 2 + 1), r = dfs(k * 2 + 2);
	if (l == -1 && r == -1)return -1;
	if (l == -1)return r;
	if (r == -1)return l;
	cnt++; return l;
}
int main(){
	scanf("%d%d", &n, &m);
	rep(i, m) {
		int b; scanf("%d", &b);
		a[b] = 1;
	}
	dfs(0);
	printf("%d\n", cnt);
}