program choose (fin,fout);
var
fin,fout:text;
n,k:integer;
a,b:array [1..20] of longint;
i,j,swap:integer;
s,p:longint;
sum:longint;
procedure jurde (t:longint);
var
i:longint;
begin
for i:=2 to trunc(sqrt(t)) do
if (t mod i=0) then exit;
sum:=sum+1;
end;
procedure chose(f,t:integer);
var
i:integer;
begin
for i:=t to n do
begin
s:=s+a[i];
if (f=k) then begin p:=p+1; jurde(s);end;
if (f<k) then chose (f+1,i+1);
s:=s-a[i];
end;{for}
end;
begin
assign (fin,'choose.in');
reset (fin);
assign (fout,'choose.out');
rewrite (Fout);
p:=0;
readln (fin,n,k);
for i:=1 to n do
read (fin,a[i]);
{Being in order}
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]<a[j]
then begin
swap:=a[i];
a[i]:=a[j];
a[j]:=swap;
end;
sum:=0;
chose(1,1);
write (fout,sum);
close (fin);
close (fout);
end.