import itertools import copy h, w = map(int, input().split()) start_x, start_y = None, None field = [list(input()) for _ in range(h)] black_n = "".join(map("".join, field)).count("#") if black_n > 0 and black_n % 2: print("NO") exit() def check(y, x): global start_x, start_y if field[y][x] != "#": return False if start_x is None: start_x = x start_y = y dx, dy = x - start_x, y - start_y m = copy.deepcopy(field) for red_y in range(h): for red_x in range(w): if m[red_y][red_x] == "#": m[red_y][red_x] = "@" nx = red_x + dx ny = red_y + dy if ny >= h or nx >= w or m[ny][nx] != "#": return False m[ny][nx] = "@" return True for i in range(h): for j in range(w): if check(i, j): print("YES") exit() print("NO")