using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Petlja_4
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz = Console.ReadLine().Split();
            int h = int.Parse(ulaz[0]);
            int w = int.Parse(ulaz[1]);
            char[,] matrica = new char[h, w];
            int c = -1;
            for (int i = 0; i < h; i++)
            {
                string Sulaz = Console.ReadLine();
                for (int j = 0; j < w; j++)
                {
                    matrica[i, j] = Sulaz[j];
                }
            }
            Console.WriteLine(c);
        }
    }
}