#include<iostream>
using namespace std;
char a[9][9];
int n,m;
int cnt;
bool col[9];
void solve(int t,int k)
{   int i;
    if(k==m)
    {   cnt++;
        return ;
    }
    if(t>n)
    {  
        return ;
    }
    for(i=1;i<=n;i++)
    {  
        if(!col[i]&&a[t][i]=='#')
        {  
            col[i]=1;
            solve(t+1,k+1);
            col[i]=0;
        }
       
    }
    solve(t+1,k);
}
int main()
{  
    int i,j;
    while(1)
    {    scanf("%d%d",&n,&m);
         getchar();
         if(n==-1&&m==-1)
            break;
        
         for(i=1;i<=n;i++)
         {  
             for(j=1;j<=n;j++)
             {  
                 scanf("%c",&a[i][j]);
             }
             getchar();
         }
         memset(col,0,sizeof(col));
         cnt=0;
         solve(1,0);
         printf("%d\n",cnt);
    }
    system("pause");
    return 0;
}