#include <bits/stdc++.h>
using namespace std;
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
bool in_area(int x, int y, int W, int H) {
  bool in;
  in = (0 <= x && x < W) && (0 <= y && y < H);
  return in;
}
string count_bomb_zone(string s[], int x, int y, int W, int H) {
  int k, _x, _y, count = 0;
  if (s[y].at(x) == '.') return ".";
  for (k = 0; k < 4; k++) {
    _x = x + dx[k];
    _y = y + dy[k];
    if (in_area(_x, _y, W, H) && s[_y].at(_x) == '#') {
      count++;
    }
  }
  return to_string(count);
}
int main() {
  int H, W, x, y;
  string S[50];
  bool can = true;
  cin >> H >> W;
  for (y = 0; y < H; y++) {
    cin >> S[y];
  }
  for (y = 0; y < H; y++) {
    for (x = 0; x < W; x++) {
      if (count_bomb_zone(S, x, y, W, H) == "0") can = false;
    }
  }
  if (can) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
