import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from math import gcd import itertools H,W = map(int,readline().split()) data = ''.join(read().decode().split()) def test(a,b): # ax + by = const 上をまとめる words = [[] for _ in range(5000)] for x,y in itertools.product(range(H), range(W)): key = a * x + b * y words[key].append(data[W*x+y]) for w in words: if ''.join(w).replace('##','').count('#'): return False return True answer = 'YES' if any(test(a,b) for a in range(50) for b in range(-50,50)) else 'NO' print(answer)