program MayLava;
var
q:array[1..20]of longint;
n,k,sum:longint;
procedure start;
var
f:text;
i:integer;
begin
assign(f,'choose.in');
reset(f);
readln(f,n,k);
for i:=1 to n do
read(f,q[i]);
close(f);
sum:=0;
end;
function check(x:longint):boolean;
var
i:integer;
begin
for i:=2 to trunc(sqrt(x)) do
if (x/i)=trunc(x/i) then exit(false);
exit(true);
end;
procedure hunt(a,p,x:longint);
begin
if p>n then exit;
if x=k then begin
if check(a) then inc(sum);
exit;
end;
hunt(a+q[p+1],p+1,x+1);
hunt(a,p+1,x);
end;
procedure print;
var
f:text;
begin
assign(f,'choose.out');
rewrite(f);
writeln(f,sum);
close(f);
end;
{===============main=================}
BEGIN
start;
hunt(0,0,0);
print;
END.