#include<stdio.h>
using namespace std;

int h,w,p[501][501],i,j;
char c,pom;

int main()
{
	scanf("%d%d",&h,&w);
	
	for (i=1;i<=h;i++)
	{
	 for (j=1;j<=w;j++)
	 {
	 	scanf("%c",&c);
	 	if (c=='#') p[i][j]=0; else p[i][j]=1;
	 }
	 scanf("%c",&pom);
	}
	 
	 printf("-1");
}