H, W = map(int, input().split())
lst = [[0 for x in range(W)] for y in range(H)]

for i in range(H):
  x = input().split()
  x = list(x[0])
  for j,l in enumerate(x):
    lst[i][j] = l

for i in range(H):
  for j in range(W):
    checker = []
    if lst[i][j] == '#':
      if i != 0:
        num = 1 if lst[i - 1][j] == '.' else 0
        checker.append(num)
      if i != H - 1:
        num = 1 if lst[i + 1][j] == '.' else 0
        checker.append(num)
      if j != 0:
        num = 1 if lst[i][j - 1] == '.' else 0
        checker.append(num)
      if j != W - 1:
        num = 1 if lst[i][j + 1] == '.' else 0
        checker.append(num)
    
    if len(checker) == sum(checker) and len(checker) != 0:
      print(False)
      exit()

print(True)