#include <bits/stdc++.h>
char maze[51][51];
bool mark[51][51];
int n, m;
int go[][2] = {0, 1, 0, -1, 1, 0, -1, 0};
int cnt;
void DFS(int x, int y) {
  for (int i = 0; i < 4; i++) {
    int nx = x + go[i][0];
    int ny = y + go[i][1];
    if (nx < 0 || nx >= n || ny < 0 || ny >= m) continue;
    if (maze[nx][ny] == '.') continue;
    if (mark[nx][ny] == true) continue;
    cnt++;
    mark[nx][ny] = true;
    DFS(nx, ny);
  }
  return;
}
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        mark[i][j] = false;
      }
    }
    for (int i = 0; i < n; i++) {
      scanf("%s", maze[i]);
    }
    bool success = true;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (maze[i][j] == '.') continue;
        if (mark[i][j] == true) continue;
        cnt = 1;
        DFS(i, j);
        if (cnt == 1) success = false;
      }
    }
    puts(success == true ? "YES" : "NO");
  }
  return 0;
}
