https://vjudge.net/contest/278989#problem/H
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char c[100][100];
int m,n,j,l,v[100];
int f(int m,int k)
{
if (k<=0)
return 1;
if (n==m)
return 0;
int ret=f(m+1,k);
for (int i=0; i<n; i++)
if (v[i]==0&&c[m][i]=='#')
{
v[i]=1;
ret+=f(m+1,k-1);
v[i]=0;
}
return ret;
}
int main()
{
int k;
while (scanf("%d%d",&n,&k))
{
getchar();
if (n==-1&&k==-1)
break;
memset(c,0,sizeof(c));
memset(v,0,sizeof(v));
for (int i=0; i<n; i++)
gets(c[i]);
printf("%d\n",f(0,k));
}
}