//新生训练
#include <iostream>
#include <algorithm>
using namespace std;
char a[10][10];
char limit[10];
int n, k;
int ans = 0;
void dfs(int u, int cnt)
{int m;if (cnt == k){++ans;return;}if (u > n){return;}for (int i = 1; i <= n; ++i){if (a[u][i] == '#' && !limit[i]){limit[i] = 1;dfs(u + 1, cnt + 1);limit[i] = 0;}}dfs(u + 1, cnt);
}
int main()
{while (cin >> n >> k){if (n == -1 && k == -1){return 0;}for (int i = 1; i <= n; ++i){cin >> a[i] + 1;}dfs(1, 0);cout << ans << endl;ans = 0;}return 0;
}
//递归和递推算是告一段落了,笔者也要学习新知了 hwh ;
~~~//仅当笔者个人备忘录使用。