uses math;
var
dp:array[0..101,0..101] of int64;
a:array[0..101] of longint;
sum:int64;
n,m,i,j,k:longint;
s:ansistring;
begin
assign(input,'input.txt'); reset(input);
assign(output,'output.txt'); rewrite(output);
readln(n,m);
for i:=1 to n do
begin
readln(s);
for j:=1 to length(s) do
if s[j] in['-','+',':','*'] then inc(a[i]);
end;
dp[0][0]:=1;
for i:=1 to n do
begin
for j:=0 to i-1 do
if(a[j]<a[i]) then
for k:=1 to min(i,m) do
dp[i][k]:=dp[i][k]+dp[j][k-1];
end;
sum:=0;
for i:=1 to n do
sum:=sum+dp[i][m];
if sum = 0 then writeln(-1) else
writeln(sum);
end.
dXNlcyBtYXRoOwoKdmFyCiAgICBkcDphcnJheVswLi4xMDEsMC4uMTAxXSBvZiBpbnQ2NDsKICAgIGE6YXJyYXlbMC4uMTAxXSBvZiBsb25naW50OwogICAgc3VtOmludDY0OwogICAgbixtLGksaixrOmxvbmdpbnQ7CiAgICBzOmFuc2lzdHJpbmc7CgogYmVnaW4KCiAgYXNzaWduKGlucHV0LCdpbnB1dC50eHQnKTsgcmVzZXQoaW5wdXQpOwogIGFzc2lnbihvdXRwdXQsJ291dHB1dC50eHQnKTsgcmV3cml0ZShvdXRwdXQpOwoKICByZWFkbG4obixtKTsKICAgZm9yIGk6PTEgdG8gbiBkbwogICAgYmVnaW4KICAgICByZWFkbG4ocyk7CiAgICAgIGZvciBqOj0xIHRvIGxlbmd0aChzKSBkbwogICAgICAgaWYgc1tqXSBpblsnLScsJysnLCc6JywnKiddIHRoZW4gaW5jKGFbaV0pOwogICAgZW5kOwoKICAgICBkcFswXVswXTo9MTsKCiAgICAgZm9yIGk6PTEgdG8gbiBkbwogICAgICBiZWdpbgogICAgICAgZm9yIGo6PTAgdG8gaS0xIGRvCiAgICAgICAgaWYoYVtqXTxhW2ldKSB0aGVuCiAgICAgICAgIGZvciBrOj0xIHRvIG1pbihpLG0pIGRvCiAgICAgICAgICAgZHBbaV1ba106PWRwW2ldW2tdK2RwW2pdW2stMV07CiAgICAgICBlbmQ7CgogICAgICAgIHN1bTo9MDsKICAgICAgICAgZm9yIGk6PTEgdG8gbiBkbwogICAgICAgICAgc3VtOj1zdW0rZHBbaV1bbV07CgogICAgICAgICAgIGlmIHN1bSA9IDAgdGhlbiB3cml0ZWxuKC0xKSBlbHNlCgogICAgICAgICAgd3JpdGVsbihzdW0pOwoKIGVuZC4=