type
	integer = longint;
var
	n, k, q, i, j, now : integer;
	a : array of integer;
begin
	assign(input, 'elections.in');
	assign(output, 'elections.out');
	reset(input);
	rewrite(output);
	read(n, k);
	setlength(a, n);
	for i := 1 to n do 
		a[i] := i;
	for i := 1 to k do begin
		read(q);
		now := 0;
		for j := 1 to n do begin
			if a[j] mod q <> 0 then begin
				inc(now);
				a[now] := a[j];
			end;
		end;
		n := now;
	end;
	writeln(n);
end.
