#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 7;
const int MM = 4 * M;
const long long MOD = 1e9 + 7;
const int oo = 1e9;
const long long MAX = 1e18;
int n, m;
char a[1005][1005], ch[1005][1005];
bool can(int x, int y) {
  int co = 0;
  for (long long i = (x - 1); i <= (x + 1); ++i)
    for (long long j = (y - 1); j <= (y + 1); ++j)
      if (a[i][j] == '#') co++;
  if (a[x][y] == '#') co--;
  if (co == 8) return 1;
  return 0;
}
void fil(int x, int y) {
  char bo = ch[x][y];
  for (long long i = (x - 1); i <= (x + 1); ++i)
    for (long long j = (y - 1); j <= (y + 1); ++j) ch[i][j] = '#';
  ch[x][y] = bo;
}
long long solve() {
  cin >> n >> m;
  for (long long i = (1); i <= (n); ++i)
    for (long long j = (1); j <= (m); ++j) cin >> a[i][j], ch[i][j] = '.';
  for (long long i = (2); i <= (n - 1); ++i)
    for (long long j = (2); j <= (m - 1); ++j) {
      if (can(i, j)) {
        fil(i, j);
      }
    }
  for (long long i = (1); i <= (n); ++i) {
    for (long long j = (1); j <= (m); ++j)
      if (ch[i][j] != a[i][j]) {
        cout << "NO";
        return 0;
      }
  }
  cout << "YES";
}
int main() {
  ios::sync_with_stdio(0);
  solve();
  return 0;
}
