1 #include<iostream>
2 #include<string.h>
3 #include<stdio.h>
4 using namespace std;
5 int n,m,cnt;
6 bool column[10];
7 char f[10][10];
8 void dfs(int step,int t)
9 {
10 if(t>m)
11 {
12 ++cnt;
13 return;
14 }
15 if(step>n)return;
16 for(int i=1;i<=n;++i)
17 if(!column[i] && f[step][i]=='#')
18 {
19 column[i]=1;
20 dfs(step+1,t+1);
21 column[i]=0;
22 }
23 dfs(step+1,t);
24 }
25 int main()
26 {
27 // freopen("board.in","r",stdin);
28 // freopen("board.out","w",stdout);
29 while(~scanf("%d%d",&n,&m))
30 {
31 if(n==-1 && m==-1) break;
32 if(m>n)
33 {
34 printf("0");
35 continue;
36 }
37 for(int i=1;i<=n;++i)
38 for(int j=1;j<=n;++j)
39 cin>>f[i][j];
40 cnt=0;
41 memset(column,0,sizeof(column));
42 dfs(1,1);
43 printf("%d\n",cnt);
44 }
45 }
46 /*
47 2 1
48 #.
49 .#
50 4 4
51 ...#
52 ..#.
53 .#..
54 #...
55 -1 -1
56 */