program ex(f1,f2);
type
zs=array [1..1230] of integer;
zn=array [1..2000] of longint;
na=array [1..21] of longint;
var
ss:zs; a,b:na; f1,f2:text;
i,j,k,m,n:integer; total:longint; answer:longint;
procedure sushubiao;
var i,j,q,m:integer; flag:boolean;
begin
q:=2;
for i:=5 to 10000 do
begin
flag:=true;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then
begin
flag:=false;
break;
end;
if flag then
begin
inc(q);
ss[q]:=i;
end;
end;
end;
procedure panduan(shu:integer);
var v:integer; flag2:boolean;
begin
v:=1; flag2:=true;
while (trunc(sqrt(shu))>=ss[v]) and (flag2) do
begin
if shu mod ss[v]=0 then flag2:=false;
inc(v);
end;
if flag2=true then inc(answer);
end;
procedure pailie(p,step:integer);
var i:integer;
begin
for i:=p to n do
begin
b[step]:=a[i];
if step=k then
begin
total:=0;
for j:=1 to k do total:=total+b[j];
panduan(total);
end
else
pailie(i+1,step+1);
end;
end;
begin
assign(f1,'choose.in'); reset(f1);
assign(f2,'choose.out'); rewrite(f2);
readln(f1,n,k);
for i:=1 to n do read(f1,a[i]);
ss[1]:=2; ss[2]:=3;
answer:=0;
sushubiao;
for i:=1 to n do b[i]:=0;
pailie(1,1);
writeln(f2,answer);
close(f1);
close(f2);
end.