#include<bits/stdc++.h>
using namespace std;
const int N=10;
int n,k;
char g[N][N];
//记录每列放没放过
bool st[N];
int res=0;
//x表示当前枚举到了哪一行,cnt记录放了几颗棋
void dfs(int x,int cnt){
if(cnt==k){
res++;
return ;
}
if(x>=n) return ;
//这整个for循环就是表示这行选所以下面不选的dfs应该放在for外面
for(int i=0;i<n;i++){
if(!st[i]&&g[x][i]=='#'){
st[i]=true;
dfs(x+1,cnt+1);
st[i]=false;
// dfs(x+1,cnt);
}
}
dfs(x+1,cnt);
}
int main(){
while(cin>>n>>k,n>0&&k>0){
for(int i=0;i<n;i++){
scanf("%s",g[i]);
}
res=0;
dfs(0,0);
printf("%d\n",res);
}
return 0;
}