#include<iostream> #include<cstring> using namespace std; int n,k,total,m; char ch[10][10]; bool book[10]; void dfs(int cur){ if(m==k){ total++; return; } if(cur>=n){ return; } for(int i=0;i<n;i++){ if(!book[i]&&ch[cur][i]=='#'){ m++; book[i] = true; dfs(cur+1); m--; book[i] = false; } } dfs(cur+1); } int main(){ while(scanf("%d%d",&n,&k)==2&&n!=-1){ for(int i=0;i<n;i++){ scanf("%s",ch[i]); } memset(book,false,sizeof book); total = m = 0; dfs(0); printf("%d\n",total); } return 0; }