- 选数
- 2016-08-03 12:38:32 @
program p1894;
var
n,k,i,g,ans,h,t:longint;
x:array[1..20] of longint;
a:array[0..20] of integer;
begin
readln(n,k);
for i:=1 to n do
read(x[i]);
for i:=0 to n do
a[i]:=0;
while a[0]=0 do
begin
g:=0;
a[n]:=a[n]+1;
h:=0;
t:=0;
for i:=n downto 1 do
begin
if a[i]=2 then begin
a[i]:=0;
a[i-1]:=a[i-1]+1;
end;
end;
for i:=1 to n do
if a[i]=1 then g:=g+1;
if g=k then
begin
for i:=1 to n do
if a[i]=1 then h:=h+x[i];
for i:=2 to h-1 do
if h mod i=0 then t:=1;
if t=0 then ans:=ans+1;
end;
end;
write(ans);
end.