H,W = map(int,input().split()) S = [] for i in range(H): S.append(input()) def translation(px,py): C = [[0 for x in range(W)] for y in range(H)] for y in range(H): for x in range(W): if C[y][x] == 0: C[y][x] = 1 if x + px < W and y + py < H: if S[y][x] != S[y + py][x + px]: return False C[y + py][x + px] = 1 else: if S[y][x] != '.': return False return True def check(): for y in range(H): for x in range(W): if translation(y,x): return 'YES' return 'NO' print(check())