#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int vis[10];
char mp[10][10];
int n, k;
int ans, cnt;
void dfs(int x)
{
//棋子全部放完
if(cnt == k)
{
ans++;
return ;
}
//超出棋盘边界
if(x > n) return ;
for(int i = 1; i <= n; i++)
if(!vis[i] && mp[x][i] == '#')
{
vis[i] = 1;
cnt++;
dfs(x+1);
//回溯
vis[i] = 0;
cnt--;
}
dfs(x+1);
}
int main()
{
while(cin >> n >> k)
{
if(n == -1 && k == -1) break;
//初始化数值
ans = cnt = 0;
memset(vis, 0, sizeof(vis));
for(int i = 1; i <= n; i++)
cin >> mp[i] + 1;
//从第一行开始遍历
dfs(1);
cout << ans << endl;
}
return 0;
}
/*
2 1
#.
.#
4 4
...#
..#.
.#..
#...
-1 -1
*/