#include<bits/stdc++.h>
using namespace std;
int vis[20];
char G[20][20];
int ans, n, k;
int dfs(int x, int total) {
if (total == k) {
ans++;
return 0;
}
for (int i = x; i < n; i++)
for (int j = 0; j < n; j++)
if (!vis[j] && G[i][j] == '#') {
vis[j] = 1;
dfs(i + 1, total + 1);
vis[j] = 0;
}
return 0;
}
int main() {
while (cin >> n >> k) {
if (n == -1 && k == -1) break;
//memset(vis, 0, sizeof(vis));
//memset(G, 0, sizeof(G));
for (int i = 0; i < n; i++)
cin >> G[i];
ans = 0;
dfs(0, 0);
cout << ans << endl;
}
return 0;
}