以二进制确定选用的数,相加、判断、输出,label 1;
var n,k,i,j,s,s1,x:longint;
a,b:array [0..10000] of longint;
begin
read (n,k);
for i:=1 to n do read (A[i]);
while b[0]=0 do begin
x:=0;
s:=0;
j:=n;
While b[j]=1 do dec(j);
b[j]:=1;
For i:=j+1 to n do b[i]:=0;
for i:=1 to n do if b[i]=1 then x:=x+1;
if x=k then begin
For i:=1 to n do
If b[i]=1 then s:=s+a[i];
for i:=2 to n-1 do
if s mod i=0 then goto 1;
s1:=s1+1;
1:end;
end;
write (s1);
end.