import std.stdio, std.string, std.conv, std.array, std.algorithm;

void main(){
	auto a = readln.split.map!(to!int);
	int n = a[0];
	int m = a[1];
	int c;
	int cnt,gomi;

	for(uint i;i<m;++i){
		auto b = readln.split.map!(to!int);
		c = b[0];
		if(c<n){
			cnt += n-c;
			if(n-c>gomi) gomi = n-c;
		}
	}
	writeln(cnt-gomi);
}