class LIST: __slots__ = ['li', 'len_li', 'err', 'b', 'ma', 'left', 'right'] def __init__(self, li, err): self.li = li self.len_li = len(li) self.err = err self.b = [0] * self.len_li self.ma = {a:i for i, a in enumerate(li)} self.left = 0 self.right = self.len_li - 1 def __len__(self): return self.b.count(0) def reset(self): self.b = [0] * self.len_li self.left = 0 def pop(self): for i in range(self.right, self.left - 1, -1): if self.b[i] == 0: self.b[i] = 1 for j in range(i - 1, self.left - 1, -1): if self.b[j] == 0: self.right = j break return self.li[i] return self.err def pop(self, a): self.b[a] = 1 return self.li[a] def popleft(self): for i in range(self.left, self.len_li): if self.b[i] == 0: self.b[i] = 1 for j in range(i + 1, self.len_li): if self.b[j] == 0: self.left = j break return self.li[i] return self.err def find(self, a): if a in self.ma and self.b[self.ma[a]] == 0: return True return False def remove(self, a): if self.find(a): self.b[self.ma[a]] = 1 return True return False def f(m, yx, n): for _ in range(n): if not m.remove(m.popleft() + yx): return False return True def solve(): h, w = map(int, input().split()) s = tuple(input() for _ in range(h)) m = tuple(complex(i, j) for i in range(h) for j in range(w) if s[i][j] == '#') if m == () or len(m) & 1: return "NO" a = m[0] dp = LIST(m[1:], complex(-100, -100)) n = len(dp) // 2 for i in range(len(dp)): if f(dp, dp.pop(i) - a, n): return "YES" dp.reset() return "NO" print(solve())