#include <bits/stdc++.h>
using namespace std;
int n, k, ans;
string mg[105];
bool vis[105][105];
bool pd(int x, int y)
{
for (int i = 0; i < n; i++)
if (i == x)
continue;
else if (vis[i][y])
return false;
return true;
}
void dfs(int x, int y, int step)
{
if (step == k)
{
ans++;
return;
}
for (int i = x + 1; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (mg[i][j] == '#' && pd(i, j))
{
vis[i][j] = true;
dfs(i, j, step + 1);
vis[i][j] = false;
}
}
}
}
int main()
{
while (cin >> n >> k)
{
if (n == -1 && k == -1)
break;
for (int i = 0; i < n; i++)
cin >> mg[i];
ans = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (mg[i][j] == '#')
{
vis[i][j] = true;
dfs(i, j, 1);
vis[i][j] = false;
}
cout << ans << '\n';
memset(vis, 0, sizeof(vis));
}
return 0;
}