a, b = map(int, input().split(' ')) sq = [input().strip() for i in range(a)] sq2 = [c for k in sq for c in k] ans = 'NO' if ('#' not in sq2) or sq2.count('#') % 2 == 1: print('NO') exit() for h in range(a): for w in range(-b, b): if not(h == 0 and w == 0): sq3 = sq2[:] for t in range(len(sq2)): if sq3[t] == '#': if 0<=t+w+(h*b)