import java.util.Scanner;
public class Main {//dfs排列
static char a[][]=new char[100][100];
static Scanner scanner=new Scanner(System.in);
static int n;
static int k;
static int re=0;
static boolean st[]=new boolean[100];
public static void main(String[] args) {
while (true) {
n=scanner.nextInt();
k=scanner.nextInt();
if(n<0||k<0)break;
for (int i = 0; i < n; i) {
String s=scanner.next();
for (int j = 0; j < n; j) {
a[i][j]=s.charAt(j);
}
}
re=0;
dfs(0,0);
System.out.println(re);
}
}
public static void dfs(int x,int sum) {
if(x>n)return;
if(sum==k) {
re; //数量等于k 方案+1;
return;
}
for (int i = 0; i < n; i) {//判断第x行
if(!st[i]&&a[x][i]==’#’) {
st[i]=true;
dfs(x+1,sum+1);
st[i]=false;
}
}
dfs(x+1, sum);//进入下一行
}
}