/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author Prakash
 */
public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int m=in.nextInt();
        char[][] s=new char[n][m];
        for(int i=0;i<n;i++){
            //char[] c=new char[m];
            s[i]=in.next().toCharArray();
        }
        for(int i=1;i<n-1;i++){
            for(int j=1;j<m-1;j++){
                if(s[i-1][j-1]!='.' && s[i-1][j]!='.' && s[i-1][j+1]!='.' && s[i][j-1]!='.' && s[i][j+1]!='.' &&
                        s[i+1][j-1]!='.' && s[i+1][j]!='.' && s[i+1][j+1]!='.'){
                    s[i-1][j-1]='X';
                    s[i-1][j]='X';
                    s[i-1][j+1]='X';
                    s[i][j-1]='X';
                    s[i][j+1]='X';
                    s[i+1][j-1]='X';
                    s[i+1][j]='X';
                    s[i+1][j+1]='X';
                }
            }
        }
        boolean flag=true;
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++)
                if(s[i][j]=='#'){
                    flag=false;
                    break;
                }
        if(flag)
            System.out.println("yes");
        else
            System.out.println("no");
    }
}

import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class forgery {

	public static void main(String[] args) throws Exception {
		new forgery().run();
	}

	public void run() throws Exception {
		FastIO file = new FastIO();
		int n = file.nextInt();
		int m = file.nextInt();
		char[][] c = new char[n][m];
		for (int i = 0; i < n; i++) c[i] = file.next().toCharArray();
		boolean[][] b = new boolean[n][m];
		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {
				if (c[i+1][j] == '#' && c[i-1][j] == '#' && c[i][j+1] == '#' && c[i][j-1] == '#' && c[i+1][j+1] == '#' && c[i-1][j-1] == '#' && c[i-1][j+1] == '#' && c[i+1][j-1] == '#') {
					b[i+1][j] = true; b[i-1][j] = true; b[i][j+1] = true; b[i][j-1] = true; b[i+1][j+1] = true; b[i-1][j-1] = true; b[i-1][j+1] = true; b[i+1][j-1] = true;
				}
			}
		}
		boolean bb = true;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (c[i][j] == '#' && !b[i][j]) bb = false;
			}
		}
		System.out.println(bb ? "YES" : "NO");
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, (p - 1) / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, (p - 1) / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}

import static java.util.Arrays.*;

import java.util.*;
import java.util.stream.*;

public class B {

	public Object solve() {
		int N = sc.nextInt(), M = sc.nextInt();
		char [][] A = sc.nextChars(N);

		char [][] B = new char [N][M];
		for (char [] b : B)
			fill(b, '.');

		for (int i : rep(N-2))
			next: for (int j : rep(M-2)) {
				for (int u : rep(3))
					for (int v : rep(3))
						if (u*v != 1)
							if (A[i+u][j+v] == '.')
								continue next;
				for (int u : rep(3))
					for (int v : rep(3))
						if (u*v != 1)
							B[i+u][j+v] = '#';
			}

		boolean res = Arrays.deepEquals(A, B);
		return exit(res ? "YES" : "NO");
	}

	private static final boolean ONE_TEST_CASE = true;

	private static void init() {
	}

	private static IntStream range(int N) { return IntStream.range(0, N); }
	private static Iterable<Integer> rep (int N) { return rep(0, N); }
	private static Iterable<Integer> rep (final int S, final int T) { return new Iterable<Integer>() { public Iterator<Integer> iterator() { return S < T ? java.util.stream.IntStream.range(S,  T).iterator() : Collections.emptyIterator(); } }; }
	////////////////////////////////////////////////////////////////////////////////////
	private static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static Object print (Object o, Object ... A) { IOUtils.print(o, A); return null; }
	private static Object exit (Object o, Object ... A) { print(o, A); IOUtils.exit(); return null; }
	private static class IOUtils {
		public static class MyScanner {
			public String next() { newLine(); return line[index++]; }
			public int nextInt() { return Integer.parseInt(next()); }
			public char [] nextChars() { return next ().toCharArray (); }
			public char[][] nextChars(int N) { return range(N).mapToObj(i -> nextChars()).toArray(char[][]::new); }
			//////////////////////////////////////////////
			private boolean eol() { return index == line.length; }
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] line;
			private int index;
			private void newLine() {
				if (line == null || eol()) {
					line = split(readLine());
					index = 0;
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object ... A) { return buildDelim(" ", o, A); }
		private static String buildDelim(String delim, Object o, Object ... A) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : A)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static final java.text.DecimalFormat formatter = new java.text.DecimalFormat("#.#########");
		private static void start() { if (t == 0) t = millis(); }
		private static void append(java.util.function.Consumer<Object> f, java.util.function.Consumer<Object> g, final Object o) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					f.accept(java.lang.reflect.Array.get(o, i));
			}
			else if (o instanceof Iterable<?>)
				((Iterable<?>)o).forEach(f::accept);
			else
				g.accept(o instanceof Double ? formatter.format(o) : o);
		}
		private static void append(final StringBuilder b, Object o, final String delim) {
			append(x -> { append(b, x, delim); }, x -> b.append(delim).append(x), o);
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static Object print(Object o, Object ... A) { pw.println(build(o, A)); return null; }
		private static void err(Object o, Object ... A) { System.err.println(build(o, A)); }
		private static boolean PRINT;
		private static void write(Object o) {
			err(o, '(', time(), ')');
			if (PRINT)
				pw.println(o);
		}
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
		private static void run(int N) {
			try { PRINT = System.getProperties().containsKey("PRINT"); }
			catch (Throwable t) {}

			for (int n = 1; n <= N; ++n) {
				Object res = new B().solve();
				if (res != null)
					write("Case #" + n + ": " + build(res));
			}
			exit();
		}
	}
	public static void main(String[] args) {
		init();
		int N = ONE_TEST_CASE ? 1 : sc.nextInt();
		IOUtils.run(N);
	}
}

import java.io.*;
import java.math.*;
import java.util.*;
@SuppressWarnings("Duplicates")
// author @mdazmat9
public class codeforces{
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) throws IOException {
        int test = 1;
         //test=sc.nextInt();
        for (int ind = 0; ind < test; ind++) {
         solve();
        }
        out.flush();
    }
    static void solve(){
        int n = sc.nextInt();
        int m=sc.nextInt();
        char[][]a =char2darray(n,m);
        char[][]b=new char[n][m];
        for(int i=0;i<n;i++){
            Arrays.fill(b[i],'.');
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if (a[i][j] == '#') {
                    boolean bool=false;
                    if(i+1<n  && i+2<n && j+2<m && j+1<m){
                        if( a[i][j+1]=='#'  && a[i][j+2]=='#' &&  a[i+1][j]=='#'  && a[i+1][j+2]=='#'  && a[i+2][j]=='#' &&  a[i+2][j+1]=='#'  && a[i+2][j+2]=='#'){
                           b[i][j]= b[i][j+1]=b[i][j+2]= b[i+1][j]=b[i+1][j+2]=b[i+2][j]=b[i+2][j+1]=b[i+2][j+2]='#';
                        }
                    }
                }
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
               if(a[i][j]!=b[i][j]){
                   out.println("NO");
                   return;
               }
            }
        }

        out.println("YES");
    }

    static int[] intarray(int n){ int [] a=new int[n];for(int i=0;i<n;i++)a[i]=sc.nextInt();return a; }
    static long[] longarray(int n){ long [] a=new long[n];for(int i=0;i<n;i++)a[i]=sc.nextLong();return a; }
    static ArrayList<Integer> intlist(int n){ArrayList<Integer> list=new ArrayList<>();for(int i=0;i<n;i++)list.add(sc.nextInt());return list; }
    static ArrayList<Long> longlist(int n){ArrayList<Long> list=new ArrayList<>();for(int i=0;i<n;i++)list.add(sc.nextLong());return list; }
    static int[][] int2darray(int n,int m){ int [][] a=new int[n][m];for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ a[i][j]=sc.nextInt(); } }return a; }
    static long[][] long2darray(int n,int m){ long [][] a=new long[n][m];for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ a[i][j]=sc.nextLong(); } }return a; }
    static char[][] char2darray(int n,int m){ char [][] a=new char[n][m];for(int i=0;i<n;i++){ String s=sc.next(); a[i]=s.toCharArray(); }return a; }

    static double pi=3.14159265358979323846264;
    public static double logb( double a, double b ) {return Math.log(a) / Math.log(b); }
    static long fast_pow(long a, long b,long abs) {
        if(b == 0) return 1L;
        long val = fast_pow(a, b / 2,abs);
        if(b % 2 == 0) return val * val % abs;
        else return val * val % abs * a % abs;
    }
    static long abs = (long)1e9 + 7;
    static   void shuffle(int[] a) { int n = a.length;for(int i = 0; i < n; i++) { int r = i + (int) (Math.random() * (n - i));int tmp = a[i];a[i] = a[r];a[r] = tmp; } }
    static long gcd(long a , long b) {
        if(b == 0) return a;
        return gcd(b , a % b);
    }
}

class Scanner {
    public BufferedReader reader;
    public StringTokenizer st;
    public Scanner(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        st = null;
    }
    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            } catch (Exception e) {
                throw (new RuntimeException());
            }
        }
        return st.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

//Code by Sounak, IIEST
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Arrays;
public class Test1{
    public static void main(String args[])throws IOException{
        FastReader sc = new FastReader();
        StringBuilder sb = new StringBuilder();
        int n=sc.nextInt();
        int m=sc.nextInt();
        char p[][]=new char[n][m];
        char c[][]=new char[n][m];
        int i,j;
        for(i=0;i<n;i++)
        {
            String t=sc.next();
            for(j=0;j<m;j++)
            {
                p[i][j]=t.charAt(j);
                c[i][j]='.';
            }
        }
        for(i=0;i<n-2;i++)
        {
            for(j=0;j<m-2;j++)
            {
                if(p[i][j]=='#' && p[i][j+1]=='#' && p[i][j+2]=='#' && p[i+1][j]=='#' && p[i+1][j+2]=='#' && p[i+2][j]=='#' && p[i+2][j+1]=='#' && p[i+2][j+2]=='#')
                {
                    c[i][j]='#';
                    c[i][j+1]='#';
                    c[i][j+2]='#';
                    c[i+1][j]='#';
                    c[i+1][j+2]='#';
                    c[i+2][j]='#';
                    c[i+2][j+1]='#';
                    c[i+2][j+2]='#';
                }
            }
        }
        boolean ch=true;
        for(i=0;i<n;i++)
        {
            for(j=0;j<m;j++)
            {
                if(c[i][j]!=p[i][j])
                ch=false;
            }
        }
        if(ch)
        System.out.println("YES");
        else
        System.out.println("NO");
    }
}

class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); }
    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    int nextInt() { return Integer.parseInt(next()); }
    long nextLong() { return Long.parseLong(next()); }
    double nextDouble() { return Double.parseDouble(next()); }
    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.Scanner;

public class test {

	public static void main(String args[]) {

		Scanner s = new Scanner(System.in);

		//Input
		int n = s.nextInt(); //Rows
		int m = s.nextInt(); //Columns

	    char[][] p = new char[n][m];

		for(int i = 0; i<n; i++) {
			p[i] = s.next().toCharArray();
		}
		//End Input

		//Generate Empty Paper
		char[][] p2 = new char[n][m];
		for(int i = 0; i<n; i++) {
			for(int j = 0; j<m; j++) {
				p2[i][j] = '.';
			}
		}

		// p : Original Handwriting
		// p2: New Paper

		//Forge Handwriting
		for(int i = 1; i < (n-1) ; i++) {
			for(int j = 1; j < (m-1) ; j++) {

				//Current Location Viable?
				if(p[i-1][j-1] == '#'
				&& p[i-1][j  ] == '#'
				&& p[i-1][j+1] == '#'
				&& p[i  ][j-1] == '#'
				&& p[i  ][j+1] == '#'
				&& p[i+1][j-1] == '#'
				&& p[i+1][j  ] == '#'
				&& p[i+1][j+1] == '#') {

					p2[i-1][j-1] = '#';
					p2[i-1][j  ] = '#';
					p2[i-1][j+1] = '#';
					p2[i  ][j-1] = '#';
					p2[i  ][j+1] = '#';
					p2[i+1][j-1] = '#';
					p2[i+1][j  ] = '#';
					p2[i+1][j+1] = '#';

				}

			}
		}

		//Forged Handwriting Identical?
		boolean identical = true;

		for(int i = 0; i<n && identical; i++) {
			for(int j = 0; j<m; j++) {
				if(p[i][j] != p2[i][j]) {
					identical = false;
					break;
				}
			}
		}

		if(identical) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

		s.close();

	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static long sx = 0, sy = 0, mod = (long) (1e9 + 7);

	static ArrayList<Integer>[] a;
	static int[][][] dp;
	static long[] fa;
	static long[] farr;
	public static PrintWriter out;
	static ArrayList<pair> pa = new ArrayList<>();
	static long[] fact = new long[(int) 1e6];
	static StringBuilder sb = new StringBuilder();
	static boolean cycle = false;
	static long m = 998244353;
	static long[] no, col;
	// static String s;
	static long k = 0, n = 0;
	static int[] c;
	static long ans = 0;
	static int[] down;
	static int[] score;

	static HashMap<Integer, ArrayList<Integer>> hm;

	public static void main(String[] args) throws IOException {

//		Scanner scn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		out = new PrintWriter(System.out);
		// Reader scn = new Reader();

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		sc.nextLine();
		int[][]grid=new int[n][m];
		for(int i=0;i<n;i++){
			String s=sc.nextLine();
			for(int j=0;j<m;j++)
				if(s.charAt(j)=='#')
					grid[i][j]=2;
				else
					grid[i][j]=0;
		}
		sc.close();
		for(int i=1;i<n-1;i++)
			for(int j=1;j<m-1;j++)
				if(canPaint(grid,i,j))
					paint(grid,i,j);
		System.out.println(test(grid));
	}
	public static boolean canPaint(int[][]grid,int i,int j){
		for(int a=-1;a<=1;a++)
			for(int b=-1;b<=1;b++)
				if((a!=0||b!=0)&&grid[i+a][j+b]==0)
					return false;
		return true;
	}
	public static void paint(int[][]grid,int i,int j){
		for(int a=-1;a<=1;a++)
			for(int b=-1;b<=1;b++)
				if(a!=0||b!=0)
					grid[i+a][j+b]=1;
	}
	public static String test(int[][]grid){
		for(int[]i:grid)
			for(int j:i)
				if(j==2)
					return "NO";
		return "YES";
	}
	// _________________________TEMPLATE_____________________________________________________________

	// public static long lcm(long x, long y) {
	//
	// return (x * y) / gcd(x, y);
	// }
	//
	// private static long gcd(long x, long y) {
	// if (x == 0)
	// return y;
	//
	// return gcd(y % x, x);
	// }
	//
	// static class comp implements Comparator<Integer> {
	//
	// @Override
	// public int compare(Integer p1, Integer p2) {
	//
	// return p2 - p1;
	//
	// }
	// }
	//
	// }
	//
	// public static long pow(long a, long b) {
	//
	// if (b < 0)
	// return 0;
	// if (b == 0 || b == 1)
	// return (long) Math.pow(a, b);
	//
	// if (b % 2 == 0) {
	//
	// long ret = pow(a, b / 2);
	// ret = (ret % mod * ret % mod) % mod;
	// return ret;
	// }
	//
	// else {
	// return ((pow(a, b - 1) % mod) * a % mod) % mod;
	// }
	// }

	private static class pair implements Comparable<pair> {

		long val;
		long t;

		pair(long a, long b) {
			val = a;
			t = b;
		}

		@Override
		public int compareTo(pair o) {

			return (int) (this.val - o.val);
		}

		// @Override
		//
		// public int hashCode() {
		// return i;
		// }
		//
		// @Override
		//
		// public boolean equals(Object o) {
		//
		// pair p = (pair) o;
		// return this.i == p.i;
		// }

	}

	private static String reverse(String s) {

		return new StringBuilder(s).reverse().toString();
	}

	public static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[1000000 + 1]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}

		public int[][] nextInt2DArray(int m, int n) throws IOException {
			int[][] arr = new int[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}

		public long[][] nextInt2DArrayL(int m, int n) throws IOException {
			long[][] arr = new long[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}
		// kickstart - Solution
		// atcoder - Main
	}

}

// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF1059B extends PrintWriter {
	CF1059B() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF1059B o = new CF1059B(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		byte[][] aa = new byte[n][];
		byte[][] bb = new byte[n][m];
		for (int i = 0; i < n; i++) {
			aa[i] = sc.next().getBytes();
			Arrays.fill(bb[i], (byte) '.');
		}
		for (int i = 1; i < n - 1; i++)
			for (int j = 1; j < m - 1; j++)
				if (aa[i - 1][j - 1] == '#' && aa[i - 1][j] == '#' && aa[i - 1][j + 1] == '#' && aa[i][j - 1] == '#' && aa[i][j + 1] == '#' && aa[i + 1][j - 1] == '#' && aa[i + 1][j] == '#' && aa[i + 1][j + 1] == '#')
					bb[i - 1][j - 1] = bb[i - 1][j] = bb[i - 1][j + 1] = bb[i][j - 1] = bb[i][j + 1] = bb[i + 1][j - 1] = bb[i + 1][j] = bb[i + 1][j + 1] = '#';
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if (aa[i][j] != bb[i][j]) {
					println("NO");
					return;
				}
		println("YES");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;

public class d {
    static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        StringBuilder sb = new StringBuilder();
        String[] st=s();
        int n=i(st[0]);
         int m=i(st[1]);
         char[][] a=new char[n][m];
         char[][] ans=new char[n][m];
         for(int i=0;i<n;i++){
             for(int j=0;j<m;j++){
                 ans[i][j]='.';
             }
         }
         for(int i=0;i<n;i++){
             a[i]=s()[0].toCharArray();}int flag=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
          {
            //  System.out.print(a[i][j]+" ");

                   if(i-1>=0&&i+1<n&&j+1<m&&j-1>=0){
                        if(a[i-1][j-1]=='.'){
                            continue;
                        }else{
                        }
                       if(a[i-1][j]=='.'){
                           continue;
                       }else{
                       }     if(a[i-1][j+1]=='.'){
                           continue;
                       }else{
                       }     if(a[i][j+1]=='.'){
                           continue;
                       }else{
                       }     if(a[i+1][j+1]=='.'){
                           continue;
                       }else{
                       }     if(a[i+1][j]=='.'){
                           continue;
                       }else{
                       }     if(a[i+1][j-1]=='.'){
                           continue;
                       }else{
                       }     if(a[i][j-1]=='.'){
                           continue;
                       }else{
                       }

                       if(a[i-1][j-1]=='.'){
                           continue;
                       }else{
                           ans[i-1][j-1]='#';
                       }
                       if(a[i-1][j]=='.'){
                           continue;
                       }else{
                           ans[i-1][j]='#';
                       }     if(a[i-1][j+1]=='.'){
                           continue;
                       }else{
                           ans[i-1][j+1]='#';
                       }     if(a[i][j+1]=='.'){
                           continue;
                       }else{
                           ans[i][j+1]='#';
                       }     if(a[i+1][j+1]=='.'){
                           continue;
                       }else{
                           ans[i+1][j+1]='#';
                       }     if(a[i+1][j]=='.'){
                           continue;
                       }else{
                           ans[i+1][j]='#';
                       }     if(a[i+1][j-1]=='.'){
                           continue;
                       }else{
                           ans[i+1][j-1]='#';
                       }     if(a[i][j-1]=='.'){
                           continue;
                       }else{
                           ans[i][j-1]='#';
                       }

                   }
                }
             }
          //  System.out.println();
        }

        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(a[i][j]!=ans[i][j]){
          //          System.out.println(i+" "+j+" "+ans[i][j]);
                    flag=1;break;
                }

            }if(flag==1) break;}
            if(flag==1) System.out.println("NO");
        else System.out.println("YES");
    }
    static String[] s() throws IOException {
        return s.readLine().trim().split("\\s+");
    }

    static int i(String ss) {
        return Integer.parseInt(ss);
    }

    static long l(String ss) {
        return Long.parseLong(ss);
    }

}class Student12 {
    int  l;long r;
    public Student12(int l, long r) {
        this.l = l;
        this.r = r;
    }

    public String toString()
    {
        return this.l+" ";
    }
}
class Sortbyroll12 implements Comparator<Student12> {

    public int compare(Student12 a, Student12 b){
        if(a.l<=b.r) return -1;
     /*   else if(a.r==b.r){
            if(a.r==b.r){
                return 0;
            }
            if(a.r<b.r) return -1;
            return 1;}*/
        return 1;  }
}

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public final class Solution implements Closeable, AutoCloseable
{
  void Solve() throws NumberFormatException, IOException
  {
    int n = input.nextInt();
    int m = input.nextInt();
    char[][] a = new char[n][];
    for (int i = 0; i < n; i++)
      a[i] = input.nextToken().toCharArray();
    char[][] b = new char[n][m];
    for (int i = 0; i < n; i++)
      Arrays.fill(b[i], '.');
    for (int i = 0; i < n - 2; i++)
    {
      for (int j = 0; j < m - 2; j++)
      {
        if (a[i][j] != '#')
          continue;
        boolean match = true;
        checkMatch:
        for (int k = 0; k < 3; k++)
        {
          for (int l = 0; l < 3; l++)
          {
            if (k == 1 && l == 1)
              continue;
            if (a[i + k][j + l] != '#')
            {
              match = false;
              break checkMatch;
            }
          }
        }
        if (match)
        {
          for (int k = 0; k < 3; k++)
          {
            for (int l = 0; l < 3; l++)
            {
              if (k == 1 && l == 1)
                continue;
              b[i + k][j + l] = '#';
            }
          }
        }
      }
    }
    for (int i = 0; i < n; i++)
    {
      if (!Arrays.equals(a[i], b[i]))
      {
        output.print("NO");
        return;
      }
    }
    output.print("YES");
  }

  private final FastScanner input;
  private final PrintWriter output;

  Solution()
  {
    input = new FastScanner(System.in);
    output = new PrintWriter(System.out);
  }

  public static void main(String[] args) throws IOException
  {
    try (Solution solution = new Solution())
    {
      solution.Solve();
    }
  }

  @Override
  public void close()
  {
    output.flush();
    output.close();
  }

  @SuppressWarnings("unused")
  class FastScanner
  {
    private static final int bufferSize = 64 * 1024;
    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    FastScanner(InputStream inputStream)
    {
      this.reader = new BufferedReader(new InputStreamReader(inputStream), bufferSize);
    }

    String nextToken() throws IOException
    {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
      {
        String line = reader.readLine();
        if (line == null)
        {
          tokenizer = null;
          return null;
        }
        tokenizer = new StringTokenizer(line);
      }
      return tokenizer.nextToken();
    }

    int[] readIntArray(int n) throws IOException
    {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
      {
        a[i] = nextInt();
      }
      return a;
    }

    long[] readLongArray(int n) throws IOException
    {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
      {
        a[i] = nextLong();
      }
      return a;
    }

    int nextInt() throws NumberFormatException, IOException
    {
      return Integer.parseInt(nextToken());
    }

    long nextLong() throws NumberFormatException, IOException
    {
      return Long.parseLong(nextToken());
    }

    double nextDouble() throws NumberFormatException, IOException
    {
      return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException
    {
      tokenizer = null;
      return reader.readLine();
    }
  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        boolean[][] grid;
        boolean[][] filled;
        int N;
        int M;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            N = in.nextInt();
            M = in.nextInt();
            grid = new boolean[N][M];
            filled = new boolean[N][M];
            for (int i = 0; i < N; i++) {
                char[] s = in.next().toCharArray();
                for (int j = 0; j < M; j++) {
                    grid[i][j] = (s[j] == '#');
                }
            }
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    if (works(i, j)) {
                        fill(i, j);
                    }
                }
            }
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    if (grid[i][j] != filled[i][j]) {
                        out.println("NO");
                        return;
                    }
                }
            }
            out.println("YES");
        }

        void fill(int r, int c) {
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    if (i != 1 || j != 1) {
                        filled[r + i][c + j] = true;
                    }
                }
            }
        }

        boolean works(int r, int c) {
            if (r + 2 >= N || c + 2 >= M) {
                return false;
            } else {
                for (int i = 0; i < 3; i++) {
                    for (int j = 0; j < 3; j++) {
                        if (i != 1 || j != 1) {
                            if (!grid[r + i][c + j]) {
                                return false;
                            }
                        }
                    }
                }
                return true;
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
import java.io.*;
public class B {
	public static boolean[][] ink, can;
	public static int n, m;
	public static boolean pos;
	public static int[] dx = { -1, 0, 1 };
	public static int[] dy = { -1, 0, 1 };

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st = new StringTokenizer(br.readLine());
        n = Integer.parseInt(st.nextToken());
        m = Integer.parseInt(st.nextToken());
        ink = new boolean[n][m];
        can = new boolean[n][m];

        for (int i = 0; i < n; i++) {
        	st = new StringTokenizer(br.readLine());
        	String s = st.nextToken();
        	for (int j = 0; j < m; j++) {
        		if (s.charAt(j) == '#') ink[i][j] = true;
        		else ink[i][j] = false;
        		can[i][j] = true;
        	}
        }

        for (int i = 0; i < m; i++) {
        	can[0][i] = false;
        	can[n-1][i] = false;
        }
        for (int i = 1; i < n-1; i++) {
        	can[i][0] = false;
        	can[i][m-1] = false;
        }
        for (int i = 0; i < n; i++) {
        	for (int j = 0; j < m; j++) {
        		if (!ink[i][j]) {
        			for (int k = 0; k < 3; k++) {
        				for (int l = 0; l < 3; l++) {
        					if ((dx[k] != 0 || dy[l] != 0) && i+dx[k] >= 0 && j+dy[l] >= 0 && i+dx[k] < n && j+dy[l] < m)
        						can[i+dx[k]][j+dy[l]] = false;
        				}
        			}
        		}
        	}
        }

        //System.out.println(Arrays.deepToString(ink));
        //System.out.println(Arrays.deepToString(can));

        pos = false;
        boolean pr = false;
        outer: for (int i = 0; i < n; i++) {
        	for (int j = 0; j < m; j++) {
        		if (ink[i][j]) {
        			pos = false;
        			for (int k = 0; k < 3; k++) {
        				for (int l = 0; l < 3; l++) {
        					if ((dx[k] == 0 && dy[l] == 0) || i+dx[k] < 0 || j+dy[l] < 0 || i+dx[k] >= n || j+dy[l] >= m)
        						continue;
        					if (can[i+dx[k]][j+dy[l]]) {
        						pos = true;
        					}
        				}
        			}
        			if (!pos) {
        				System.out.println("NO");
        				pr = true;
        				break outer;
        			}

        		}
        	}
        }
        if (!pr) System.out.println("YES");

	}

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

	static class Task {

		int NN = 300005;
		int MOD = 1000000007;
		int INF = 2009000000;
		long INFINITY = 2000000000000000000L;

		char [][] a;
		boolean [][] v;

		public void solve(InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int m = in.nextInt();
			a = new char[n][m];
			v = new boolean[n][m];
			for(int i=0;i<n;++i) {
				String str = in.next();
				for(int j=0;j<m;++j) {
					a[i][j] = str.charAt(j);
					v[i][j] = false;
				}
			}
			for(int i=0;i<n;++i) {
				for(int j=0;j<m;++j) {
					if(a[i][j] == '#' && i+1<n&&a[i+1][j]=='#'&&i+2<n&&a[i+2][j]=='#'
							&& j+1<m&&a[i][j+1]=='#'&&j+2<m&&a[i][j+2]=='#'&&a[i+1][j+2]=='#'
							&& a[i+2][j+2]=='#' && a[i+2][j+1]=='#') {
						v[i][j] = true;
						v[i][j+1] = true;
						v[i][j+2] = true;
						v[i+1][j] = true;
						v[i+1][j+2] = true;
						v[i+2][j] = true;
						v[i+2][j+1] = true;
						v[i+2][j+2] = true;
					}
				}
			}
			for(int i=0;i<n;++i) {
				for(int j=0;j<m;++j) {
					if(a[i][j] == '#' && !v[i][j]) {
						out.println("NO");return;
					}
				}
			}
			out.println("YES");
		}

	}

	static void prepareIO(boolean isFileIO) {
		//long t1 = System.currentTimeMillis();
		Task solver = new Task();
		// Standard IO
		if(!isFileIO) {
			InputStream inputStream = System.in;
	        OutputStream outputStream = System.out;
	        InputReader in = new InputReader(inputStream);
	        PrintWriter out = new PrintWriter(outputStream);
	        solver.solve(in, out);
	        //out.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
	        out.close();
		}
        // File IO
		else {
			String IPfilePath = System.getProperty("user.home") + "/Downloads/ip.in";
	        String OPfilePath = System.getProperty("user.home") + "/Downloads/op.out";
	        InputReader fin = new InputReader(IPfilePath);
	        PrintWriter fout = null;
	        try {
				fout = new PrintWriter(new File(OPfilePath));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
	        solver.solve(fin, fout);
	        //fout.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
	        fout.close();
		}
	}

	public static void main(String[] args) {
        prepareIO(false);
	}

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public InputReader(String filePath) {
        	File file = new File(filePath);
            try {
				reader = new BufferedReader(new FileReader(file));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            tokenizer = null;
        }

        public String nextLine() {
        	String str = "";
        	try {
				str = reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        	return str;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
        	return Double.parseDouble(next());
        }

    }

}

/*
[ ( ^ _ ^ ) ]
*/
import java.io.*;
import java.util.*;

public class test {
    int INF = (int)1e9;
    long MOD = 1000000007;

    void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();
        char[][] s = new char[n][];
        char ee = '.', ff = '#';
        for(int i=0; i<n; i++) {
            s[i] = in.next().toCharArray();
        }
        int[][] a = new int[n][m];
        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) if(s[i][j]=='#') {
                if(i<=n-3 && j<=m-3) {
                    //show(i, j);
                    boolean f = false;
                    if(s[i][j+1]==ee) f = true;
                    else if(s[i][j+2]==ee) f = true;
                    else if(s[i+1][j]==ee || s[i+1][j+2]==ee) f = true;
                    else if(s[i+2][j]==ee || s[i+2][j+1]==ee || s[i+2][j+2]==ee) f = true;
                    if(!f) {
                        a[i][j] = a[i][j+1] = a[i][j+2] = 1;
                        a[i+1][j] = a[i+1][j+2] = 1;
                        a[i+2][j] = a[i+2][j+1] = a[i+2][j+2] = 1;
                    }
                }
            }
        }
        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) {
                if(s[i][j]=='#' && a[i][j]==0) {
                    out.println("NO");
                    return;
                }
                if(s[i][j]=='.' && a[i][j]==1) {
                    out.println("NO");
                    return;
                }
            }
        }
        out.println("YES");
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-->0) {
            new test().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }

    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    class Pair implements Comparable<Pair> {
        long f, s;

        Pair(long f, long s) {
            this.f=f;
            this.s=s;
        }

        public int hashCode() {
            int hf = (int) (f ^ (f >>> 32));
            int hs = (int) (s ^ (s >>> 32));
            return 31 * hf + hs;
        }

        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return s == other.s && f == other.f;
        }

        public int compareTo(Pair p) {
            return Long.compare(this.s, p.s);
        }

        public String toString() {
            return "(" + f + ", " + s + ")";
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class Forgery {

    int N = 1000 + 5;

    int n, m;
    char[][] b;
    boolean[][] vis = new boolean[N][N];

    void solve() {
        n = in.nextInt(); m = in.nextInt();
        b = new char[n][];
        for (int i = 0; i < n; i++) b[i] = in.nextToken().toCharArray();

        for (int x = 0; x < n; x++) {
            for (int y = 0; y < m; y++) {
                if (b[x][y] == '.') continue;
                if (ok(x, y)) mark(x, y);
            }
        }

        for (int x = 0; x < n; x++) {
            for (int y = 0; y < m; y++) {
                if (b[x][y] == '#' && !vis[x][y]) {
                    out.println("NO");
                    return;
                }
            }
        }
        out.println("YES");
    }

    boolean ok(int x, int y) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (i == 1 && j == 1) continue;
                if (x + i >= n || y + j >= m || b[x + i][y + j] == '.') return false;
            }
        }
        return true;
    }

    void mark(int x, int y) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (i == 1 && j == 1) continue;
                vis[x + i][y + j] = true;
            }
        }
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new Forgery().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.util.*;
import java.io.*;

public class Solution {

	static class FastScanner implements Closeable {
	    BufferedReader in;
	    StringTokenizer st;
	    FastScanner() throws IOException {
	        in = new BufferedReader(new InputStreamReader(System.in));
	    }
	    String next() throws IOException {
	        while (st == null || !st.hasMoreTokens()) {
	            String line = in.readLine();
	            if (line == null) {
	            	return null;
	            }
	            st = new StringTokenizer(line);
	        }
	        return st.nextToken();
	    }
	    int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    public void close() throws IOException {
	        in.close();
	        st = null;
	    }
	}

	static boolean blackBox(String n){
		for(int i = 0; i < n.length(); i++){
			char x = n.charAt(i);
			if(x != '7' && x != '4')
				return false;
		}

		return true;
	}

	public static void main(String[] args) throws IOException{

		try(FastScanner sc = new FastScanner();
			PrintWriter out = new PrintWriter(System.out)){

			int n = sc.nextInt();
			int m = sc.nextInt();
			char[][] arr = new char[n][m];

			for(int i = 0; i < n; i++)
				arr[i] = sc.next().toCharArray();

			for(int i = 1; i < n-1; i++){
				for(int j = 1; j < m-1; j++){
					if(arr[i-1][j-1] != '.' && arr[i-1][j] != '.' && arr[i-1][j+1] != '.' && arr[i][j-1] != '.' && arr[i][j+1] != '.' && arr[i+1][j-1] != '.'&& arr[i+1][j] != '.' && arr[i+1][j+1] != '.'){
						arr[i-1][j-1] = '1';
						arr[i-1][j] = '1';
						arr[i-1][j+1] = '1';
						arr[i][j-1] = '1';
						arr[i][j+1] = '1';
						arr[i+1][j-1] = '1';
						arr[i+1][j] = '1';
						arr[i+1][j+1] = '1';
					}
				}
			}

			for(int i = 0; i < n; i++){
				for(int j = 0; j < m; j++){
					if(arr[i][j] == '#'){
						System.out.println("NO");
						return;
					}
				}
			}

			System.out.println("YES");
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static int H;
    static int W;
    static char[][] C;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        C = new char[H][];
        for (int i = 0; i < H; i++) {
            C[i] = sc.next().toCharArray();
        }

        System.out.println(solve() ? "YES" : "NO");
    }

    static boolean solve() {
        for (int h = 0; h < H; h++) {
            for (int w = 0; w < W; w++) {
                if( (C[h][w] == '#' || C[h][w] == ' ' ) && check(h, w)) {
                    clear(h, w);
                }
            }
        }

//        for (int i = 0; i < H; i++) {
//            System.out.println(Arrays.toString(C[i]));
//        }
        return isAllCleared();
    }

    static boolean isAllCleared() {
        for (int h = 0; h < H; h++) {
            for (int w = 0; w < W; w++) {
                if( C[h][w] == '#' ) return false;
            }
        }
        return true;
    }

    static int[] DH = {0, 0, 0, 1, 1, 2, 2, 2};
    static int[] DW = {0, 1, 2, 0, 2, 0, 1, 2};

    static boolean check(int h, int w) {
        // w-3, w-2, w-1
        if( w > W - 3) return false;

        // h-3, h-2, h-1
        if( h > H - 3) return false;

        for (int i = 0; i < 8; i++) {
            if( C[h + DH[i]][w + DW[i]] == '.' ) return false;
        }
        return true;
    }

    static void clear(int h, int w) {
        for (int i = 0; i < 8; i++) {
            C[h + DH[i]][w + DW[i]] = ' ';
        }
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static boolean check(int[][]a,int i,int j,int n,int m)
	{
		if(i<n && i>=0 && j<m && j>=0 && a[i][j]==0 )
		{
			return true;
		}
		return false;
	}
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		String str[]=sc.nextLine().split(" ");
		int n=Integer.parseInt(str[0]);
		int m=Integer.parseInt(str[1]);
		char[][] ar=new char[n][m];
		for(int i=0;i<n;i++)
		{
	   		char[] st=sc.nextLine().toCharArray();
	   		for(int j=0;j<m;j++)
	   		{
	   	  		ar[i][j]=st[j];
	   		}
	    }
	    int[][] forbid=new int[n][m];
	    for(int i=0;i<m;i++){ forbid[0][i]=1;forbid[n-1][i]=1;}
	    for(int i=0;i<n;i++){ forbid[i][0]=1;forbid[i][m-1]=1;}
		for(int i=1;i<n-1;i++)
	    {
	   		for(int j=1;j<m-1;j++)
	   		{
	   	 	   if(ar[i][j]=='.')
	   	 	   {
	   	 	   	forbid[i-1][j]=forbid[i+1][j]=forbid[i][j+1]=forbid[i][j-1]=forbid[i-1][j-1]=forbid[i+1][j+1]=forbid[i+1][j-1]=forbid[i-1][j+1]=1;
	   	 	   }
	   		}
	   	 }
	   	 int flag=0;
		for(int i=0;i<n;i++)
	    {
	   		for(int j=0;j<m;j++)
	   		{
	   	 	   if(ar[i][j]=='#')
	   	 	   {
	   	 	   	   boolean f=check(forbid,i+1,j+1,n,m)||check(forbid,i-1,j-1,n,m)||check(forbid,i+1,j-1,n,m)||check(forbid,i-1,j+1,n,m)||check(forbid,i,j+1,n,m)||check(forbid,i,j-1,n,m)||check(forbid,i+1,j,n,m)||check(forbid,i-1,j,n,m);
	   	 			if(f==false)
	   	 			{
	   	 				flag=1;
	   	 				break;
	   	 			}

	   	 	   }
	   		}
	   		if(flag==1) break;
	   	 }
	   	  if(flag==1)
	   	  System.out.println("NO");
	   	  else
	   	  System.out.println("YES");
	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Test
{
    static PrintWriter pw = new PrintWriter(System.out);

    static boolean can(int r , int c , char[][] a , int n , int m)
    {
    	int[] x = {r , r , r-1 , r-1 , r-1 , r + 1 , r+1 , r+1};
    	int[] y = {c-1 , c+1 , c-1 , c , c+1 , c-1 , c , c+1};

    	for(int i= 0 ; i<8 ;  i++)
    	{
    		if(x[i] < 0 || x[i] >=n || y[i] < 0 || y[i] >=m)return false;

    		if(a[x[i]][y[i]] == '.')return false;
    	}

    	return true;
    }

    static void fill(boolean[][] v , int r , int c)
    {
    	int[] x = {r , r , r-1 , r-1 , r-1 , r + 1 , r+1 , r+1};
    	int[] y = {c-1 , c+1 , c-1 , c , c+1 , c-1 , c , c+1};

    	for(int i = 0 ; i<8 ; i++)v[x[i]][y[i]] = true;
    }

    public static void main(String[] args)throws Exception
    {
        Reader.init(System.in);

        int n = Reader.nextInt();
        int m = Reader.nextInt();

        boolean[][] v = new boolean[n][m];
        char[][] a = new char[n][m];

        for(int i = 0 ; i<n ; i++)
        {
        	String s = Reader.next();
        	for(int j = 0 ; j<m ; j++)
        		a[i][j] = s.charAt(j);
        }

        for(int i = 0 ; i<n ; i++)
        	for(int j = 0 ; j<m ; j++)
        		if(can(i,j,a,n,m))
        			fill(v , i , j);

        for(int i = 0 ; i<n ; i++)
        	for(int j = 0 ; j<m ; j++)
        	{
        		if(a[i][j] == '#' && !v[i][j])
        		{
        			pw.print("NO");
        			pw.close();
        			return;
        		}
        	}

        pw.print("YES");
        pw.close();

    }

}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    public static int pars(String x) {
        int num = 0;
        int i = 0;
        if (x.charAt(0) == '-') {
            i = 1;
        }
        for (; i < x.length(); i++) {
            num = num * 10 + (x.charAt(i) - '0');
        }

        if (x.charAt(0) == '-') {
            return -num;
        }

        return num;
    }

    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static void init(FileReader input) {
        reader = new BufferedReader(input);
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return pars(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

}

import java.io.*;
public class cf514b
{
	public static void main(String args[])throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str[]=(br.readLine()).split(" ");
		int n=Integer.parseInt(str[0]);
		int m=Integer.parseInt(str[1]);
		int arr[][]=new int[n][m];
		int count=0;
		for(int i=0;i<n;i++)
		{
			String k=br.readLine();
			char ch[]=k.toCharArray();
			for(int j=0;j<m;j++)
			{
				if(ch[j]=='.')
				{
					arr[i][j]=0;
				}
				else
				{
					arr[i][j]=1;
					count++;
				}
			}
		}
		int check_count=0;
		for(int i=1;i<n-1;i++)
		{
			for(int j=1;j<m-1;j++)
			{
				if(arr[i][j-1]>0&&arr[i][j+1]>0&&arr[i-1][j-1]>0&&arr[i-1][j]>0&&arr[i-1][j+1]>0&&arr[i+1][j-1]>0&&arr[i+1][j]>0&&arr[i+1][j+1]>0)
				{
					if(arr[i][j-1]==1)
					{
						arr[i][j-1]++;
						check_count++;
					}
					if(arr[i][j+1]==1)
					{
						arr[i][j+1]++;
						check_count++;
					}
					if(arr[i-1][j-1]==1)
					{
						arr[i-1][j-1]++;
						check_count++;
					}
					if(arr[i-1][j]==1)
					{
						arr[i-1][j]++;
						check_count++;
					}
					if(arr[i-1][j+1]==1)
					{
						arr[i-1][j+1]++;
						check_count++;
					}
					if(arr[i+1][j-1]==1)
					{
						arr[i+1][j-1]++;
						check_count++;
					}
					if(arr[i+1][j]==1)
					{
						arr[i+1][j]++;
						check_count++;
					}
					if(arr[i+1][j+1]==1)
					{
						arr[i+1][j+1]++;
						check_count++;
					}
				}
			}
		}
		if(check_count==count)
		{
			System.out.println("YES");
		}
		else
		{
			System.out.println("NO");
		}

	}
}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

    private static final Scanner scanner = new Scanner(System.in);

    public static void correct(int[][] a, int i1, int j1, int[][] visited){
        for(int j = j1; j <= j1 + 2; j++){
            if(a[i1][j] == 0)return;
        }
        for(int j = j1; j <= j1 + 2; j++){
            if(a[i1 + 2][j] == 0)return;
        }
        if(a[i1 + 1][j1] == 0 || a[i1 + 1][j1 + 2] == 0)return;

        for(int j = j1; j <= j1 + 2; j++){
            visited[i1][j] = 1;
        }
        for(int j = j1; j <= j1 + 2; j++){
            visited[i1 + 2][j] = 1;
        }
        visited[i1 + 1][j1] = 1;
        visited[i1 + 1][j1 + 2] = 1;
    }

    public static boolean legal(int[][] a, int i, int j){
        int n = a.length;
        int m = a[0].length;
        return i < n - 2 && j < m - 2;
    }

    public static void main(String[] args) throws IOException {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[][] a = new int[n][m];
        int[][] check = new int[n][m];
        for(int i = 0; i < n; i++){
            String s = scanner.next();
            for(int j = 0; j < s.length(); j++){
                if(s.charAt(j) == '.')a[i][j] = 0;
                else a[i][j] = 1;
            }
        }

        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if(legal(a, i, j)){
                    correct(a, i, j, check);
                }
            }
        }
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if(a[i][j] == 1 && check[i][j] == 0){
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }
}

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;

public class B {

	boolean needsFill(char[][] grid, int i, int j) {
		boolean good1 = grid[i][j] == '#' && grid[i][j + 1] == '#' && grid[i][j + 2] == '#';
		i++;
		boolean good2 = grid[i][j] == '#' && grid[i][j + 2] == '#';
		i++;
		boolean good3 = grid[i][j] == '#' && grid[i][j + 1] == '#' && grid[i][j + 2] == '#';
		return good1 && good2 && good3;
	}

	public void solve(JS in, PrintWriter out) {
		int n = in.nextInt();
		int m = in.nextInt();
		char[][] grid = new char[n][];
		for(int i = 0; i < n; ++i) {
			grid[i] = in.next().toCharArray();
		}
		char[][] me = new char[n][m];
		for(int i = 0; i < n; ++i) Arrays.fill(me[i], '.');
		for(int i = 0; i + 2 < n; ++i) {
			for(int j = 0; j + 2 < m; ++j) {
				if(needsFill(grid, i, j)) {
					for(int r = i, c1 = 0; r < i + 3; ++r, ++c1) {
						for(int c = j, c2 = 0; c < j + 3; ++c, ++c2) {
							if(c2 == 1 && c1 == 1) {
								continue;
							}
							me[r][c] = '#';
						}
					}
				}
			}
		}
		boolean good = true;
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < m; ++j) {
				if(grid[i][j] != me[i][j]) good = false;
			}
		}
		out.println(good ? "YES" : "NO");
	}

	public static void main(String[] args) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);
		new B().solve(in, out);
		out.close();
	}

	static class JS {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author math2do
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            char[][] mat = new char[n][m];
            for (int i = 0; i < n; i++) {
                String line = in.next();
                for (int j = 0; j < line.length(); j++) {
                    mat[i][j] = line.charAt(j);
                }
            }

            char[][] forbid = new char[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    forbid[i][j] = '1';
                }
            }
            for (int i = 0; i < n; i++) {
                forbid[i][0] = '0';
                forbid[i][m - 1] = '0';
            }
            for (int j = 0; j < m; j++) {
                forbid[0][j] = '0';
                forbid[n - 1][j] = '0';
            }

            for (int i = 1; i < n - 1; i++) {
                for (int j = 1; j < m - 1; j++) {
                    if (mat[i][j] == '.') {
                        forbid[i - 1][j] = '0';
                        forbid[i + 1][j] = '0';
                        forbid[i][j - 1] = '0';
                        forbid[i][j + 1] = '0';
                        forbid[i - 1][j + 1] = '0';
                        forbid[i + 1][j + 1] = '0';
                        forbid[i + 1][j - 1] = '0';
                        forbid[i - 1][j - 1] = '0';

                    }
                }
            }

            boolean found = false;
            for (int i = 0; i < n; i++) {
                boolean up = false;
                for (int j = 0; j < m; j++) {
                    int count = 0;
                    if (mat[i][j] == '#') {
                        if (i - 1 >= 0 && forbid[i - 1][j] == '1') {
                            int ic = i - 1;
                            int jc = j;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }
                        }
                        if (i + 1 < n && forbid[i + 1][j] == '1') {
                            int ic = i + 1;
                            int jc = j;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }
                        }
                        if (j - 1 >= 0 && forbid[i][j - 1] == '1') {
                            int ic = i;
                            int jc = j - 1;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }
                        }
                        if (j + 1 < m && forbid[i][j + 1] == '1') {
                            int ic = i;
                            int jc = j + 1;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }
                        }

                        if (i - 1 >= 0 && j + 1 < m && forbid[i - 1][j + 1] == '1') {
                            int ic = i - 1;
                            int jc = j + 1;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }
                        }
                        if (i + 1 < n && j + 1 < m && forbid[i + 1][j + 1] == '1') {
                            int ic = i + 1;
                            int jc = j + 1;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }
                        }
                        if (i + 1 < n && j - 1 >= 0 && forbid[i + 1][j - 1] == '1') {
                            int ic = i + 1;
                            int jc = j - 1;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }

                        }
                        if (i - 1 >= 0 && j - 1 >= 0 && forbid[i - 1][j - 1] == '1') {
                            int ic = i - 1;
                            int jc = j - 1;
                            if (mat[ic - 1][jc] == '#' && mat[ic - 1][jc + 1] == '#' && mat[ic][jc + 1] == '#' && mat[ic + 1][jc + 1] == '#' && mat[ic + 1][jc] == '#' && mat[ic + 1][jc - 1] == '#' && mat[ic][jc - 1] == '#' && mat[ic - 1][jc - 1] == '#') {
                                count++;
                            }
                        }

                        if (count == 0) {
                            up = true;
                            break;
                        }
                    }
                }

                if (up) {
                    found = true;
                    break;
                }
            }

            if (found) {
                out.println("NO");
            } else {
                out.println("YES");
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Scanner;
import java.util.stream.IntStream;

public class Solution {

	public static int[] toIntArray(String s) {
		String[] nums = s.split("\\s");
		return IntStream.range(0, nums.length)
			.map(index -> Integer.parseInt(nums[index]))
			.toArray();
	}

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int[] mn = toIntArray(scanner.nextLine());

		int n = mn[0], m = mn[1];

		char[][] signArea = new char[n][m];

		for (int i = 0; i < n; i++) {

			signArea[i] = scanner.nextLine()
					.trim()
					.toCharArray();

		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {

				placePen(signArea, i, j);
				//printArray(signArea);
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {

				if(signArea[i][j] == '#') {
					System.out.println("NO");
					return;
				}

			}
		}
		System.out.println("YES");
	}

	private static void printArray(char[][] sa) {
		for(int i = 0; i < sa.length; i++) {
			for(int j = 0; j < sa[i].length; j++) {
				System.out.print(sa[i][j]);
			}
			System.out.println();
		}
	}

	private static void placePen(char[][] signArea, int i, int j) {

		if (isWithInk(i + 1,j + 1, signArea) &&
				isWithInk(i + 1,j, signArea)&&
				isWithInk(i + 1,j - 1, signArea) &&
				isWithInk(signArea, i, j + 1)  && isWithInk(signArea,i,j - 1)  && isWithInk(signArea, i - 1, j + 1)&&
				isWithInk(signArea, i - 1,j)&& isWithInk(i - 1,j - 1,signArea )) {
			signArea[i + 1][j + 1] = 'v';
			signArea[i + 1][j] = 'v';
			signArea[i + 1][j - 1] = 'v';
			signArea[i][j + 1] = 'v';
			signArea[i][j - 1] = 'v';
			signArea[i - 1][j + 1] = 'v';
			signArea[i - 1][j] = 'v';
			signArea[i - 1][j - 1] = 'v';
		}

	}

	public static boolean isWithInk(int i, int j, char[][] signArea) {
		return signArea[i][j] == 'v' || signArea[i][j] == '#';
	}

	public static boolean isWithInk(char[][] signArea, int i, int j) {
		return signArea[i][j] == 'v' || signArea[i][j] == '#';
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Preet
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {

        char table[][];
        boolean vis[][];
        int n;
        int m;

        boolean check(int x, int y) {

            for (int i = x; i < x + 3; i++) {
                for (int j = y; j < y + 3; j++) {
                    if (table[i][j] != '#') {
                        if (i == x + 1 && j == y + 1) continue;
                        return false;
                    }
                }
            }

            return true;
        }

        void fill(int x, int y) {

            for (int i = x; i < x + 3; i++) {
                for (int j = y; j < y + 3; j++) {
                    if (i == x + 1 && j == y + 1) continue;
                    vis[i][j] = true;
                }
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {

            n = in.nextInt();
            m = in.nextInt();
            table = new char[n][m];
            vis = new boolean[n][m];

            for (int i = 0; i < n; i++) table[i] = in.next().toCharArray();

            for (int i = 0; i < n - 2; i++) {
                for (int j = 0; j < m - 2; j++) {
                    if (check(i, j)) {
                        fill(i, j);
                    }
                }
            }

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (table[i][j] == '#' && !vis[i][j]) {
                        //out.println(i+" "+j);
                        out.println("NO");
                        return;
                    }
                }
            }

            out.println("YES");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c)) {
                c = read();
            }

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.*;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class B {
    static class FastWriter {
        private final BufferedWriter bw;

        public FastWriter() {
            this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }

        public void print(Object object) throws IOException {
            bw.append("" + object);
        }

        public void println(Object object) throws IOException {
            print(object);
            bw.append("\n");
        }

        public void close() throws IOException {
            bw.close();
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        BigInteger nextBigInteger() {
            try {
                return new BigInteger(nextLine());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }
    }

    public static void main(String[] args) {
        FastReader fr = new FastReader();
        FastWriter fw = new FastWriter();
        int n = fr.nextInt();
        int m = fr.nextInt();
        int[][] arr = new int[n][m];
        int count = 0;
        for (int i = 0; i < n; i++) {
            String s = fr.next();
            for (int j = 0; j < m; j++) {
                if (s.charAt(j) == '#') {
                    arr[i][j] = 1;
                    count++;
                }
            }
        }

        int[] r = {1, 0, -1, 0, -1, 1, 1, -1};
        int[] c = {0, 1, 0, -1, -1, 1, -1, 1};
        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                boolean flag = true;
                for (int k = 0; k < 8; k++) {
                    if (arr[i + r[k]][j + c[k]] == 0) {
                        flag = false;
                        break;
                    }
                }
                if (flag) {
                    for (int k = 0; k < 8; k++) {
                        if (arr[i + r[k]][j + c[k]] == 1) {
                            arr[i + r[k]][j + c[k]] = 2;
                            count--;
                        }
                    }
                }
            }
        }

        if (count == 0) System.out.println("YES");
        else System.out.println("NO");

    }
}

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	static int[] xarr = {-1,-1,-1,0,1,1,1,0},yarr = {-1,0,1,1,1,0,-1,-1};
	static char[][] map,map1;
	static boolean[][] vis;
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		map = new char[n][m];
		vis = new boolean[n][m];
		map1 = new char[n][m];
		for(int i = 0;i < map1.length;i++) {
			String string = scanner.next();
			for(int j = 0;j < map1[0].length;j++) {
				map1[i][j] = string.charAt(j);
			}
		}
		for(int i = 0;i < map1.length;i++) {
			for(int j = 0;j < map1[0].length;j++) {
				map[i][j] = '.';
			}
		}
		bfs();
		for(int i = 0;i < map1.length;i++) {
			for(int j = 0;j < map1[0].length;j++) {
				if(map[i][j]!=map1[i][j]) {
					System.out.println("NO");
					System.exit(0);
				}
			}
		}
		System.out.println("YES");
	}
	public static void bfs() {
		Queue<node> queue = new LinkedList<node>();
		queue.add(new node(1,1));
		vis[1][1] = true;
		while(queue.size()!=0) {
			node node = queue.poll();
			f(node.x,node.y);
			for(int i = 1;i < xarr.length;i+=2) {
				int dx = node.x+xarr[i];
				int dy = node.y+yarr[i];
				if(dx<=0||dx>=map.length-1||dy<=0||dy>=map[0].length-1||vis[dx][dy])continue;
				vis[dx][dy] = true;
				queue.add(new node(dx,dy));
			}
		}
	}
	public static void f(int x,int y) {
		boolean flag = true;
		for(int i = 0;i < xarr.length;i++) {
			int dx = x+xarr[i];
			int dy = y+yarr[i];
			if(map1[dx][dy]!='#') {
				flag = false;
				break;
			}
		}
		if(flag) {
			for(int i = 0;i < xarr.length;i++) {
				int dx = x+xarr[i];
				int dy = y+yarr[i];
				map[dx][dy] = '#';
			}
		}
	}
}
class node{
	int x,y;
	public node() {};
	public node(int x,int y) {
		this.x = x;
		this.y = y;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class forgery {
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader scn=new FastReader();
		int n=scn.nextInt();
		int m=scn.nextInt();
	    char[][]arr=new char[n][m];
	    for(int i=0;i<n;i++){
	    	String s=scn.next();
	    	for(int j=0;j<m;j++){
	    		arr[i][j]=s.charAt(j);
	    	}
	    }
	    boolean[][] valid=new boolean[n][m];
//	    for(int i=0;i<n;i++){
//	    	Arrays.fill(valid,false);
//	    }
	    for(int i=0;i<n;i++){
	    	for(int j=0;j<m;j++){
	    		if(safe(i,j,n,m,arr)){
	    			fill(i,j,n,m,valid);
	    		}
	    	}
	    }
	    if(equal(arr,valid)){
	    	System.out.println("YES");
	    }else{
	    	System.out.println("NO");
	    }

	}
	public static boolean safe(int x, int y, int n, int m, char[][]arr){
		if(exist(x-1,y,n,m)){
			if(arr[x-1][y]!='#'){
				return false;
			}
		}else return false;
		if(exist(x+1,y,n,m)){
			if(arr[x+1][y]!='#'){
				return false;
			}
		}else return false;
		if(exist(x,y-1,n,m)){
			if(arr[x][y-1]!='#'){
				return false;
			}
		} else return false;
		if(exist(x,y+1,n,m)){
			if(arr[x][y+1]!='#'){
				return false;
			}
		}else return false;
		if(exist(x-1,y-1,n,m)){
			if(arr[x-1][y-1]!='#'){
				return false;
			}
		}else return false;
		if(exist(x+1,y+1,n,m)){
			if(arr[x+1][y+1]!='#'){
				return false;
			}
		}else return false;
		if(exist(x+1,y-1,n,m)){
			if(arr[x+1][y-1]!='#'){
				return false;
			}
		}else return false;
		if(exist(x-1,y+1,n,m)){
			if(arr[x-1][y+1]!='#'){
				return false;
			}
		}else return false;
		return true;
	}
	public static void fill(int x, int y, int n, int m, boolean[][]valid){
		if(exist(x-1,y,n,m)){
			if(valid[x-1][y]!=true){
				valid[x-1][y]=true;
			}
		}
		if(exist(x+1,y,n,m)){
			if(valid[x+1][y]!=true){
				valid[x+1][y]=true;
			}
		}
		if(exist(x,y-1,n,m)){
			if(valid[x][y-1]!=true){
				valid[x][y-1]=true;
			}
		}
		if(exist(x,y+1,n,m)){
			if(valid[x][y+1]!=true){
				valid[x][y+1]=true;
			}
		}
		if(exist(x-1,y-1,n,m)){
			if(valid[x-1][y-1]!=true){
				valid[x-1][y-1]=true;
			}
		}
		if(exist(x+1,y+1,n,m)){
			if(valid[x+1][y+1]!=true){
				valid[x+1][y+1]=true;
			}
		}
		if(exist(x+1,y-1,n,m)){
			if(valid[x+1][y-1]!=true){
				valid[x+1][y-1]=true;
			}
		}
		if(exist(x-1,y+1,n,m)){
			if(valid[x-1][y+1]!=true){
				valid[x-1][y+1]=true;
			}
		}

	}
	public static boolean exist(int x, int y, int n, int m){
		if(x<0 || x>=n || y<0 || y>=m){
			return false;
		}

		return true;
	}
	public static boolean equal(char[][]arr, boolean[][]valid){
		for(int i=0;i<arr.length;i++){
			for(int j=0;j<arr[0].length;j++){
				if(arr[i][j]=='#' && valid[i][j]!=true){
					return false;
				}
				if(arr[i][j]=='.' && valid[i][j]!=false){
					return false;
				}
			}
		}
	   return true;
	}

}

import java.util.*;
public class J17M10Y2018 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		sc.nextLine();
		int[][] g=new int[n][m];
		for (int i=0; i<n; i++) {
			String a=sc.nextLine();
			for (int j=0; j<m; j++) {
				char c=a.charAt(j);
				if (c=='.')
					g[i][j]=0;
				else
					g[i][j]=1;
			}
		}
		for (int i=1; i<n-1; i++) {
			for (int j=1; j<m-1; j++) {
				if (g[i+1][j]>=1 && g[i+1][j-1]>=1 && g[i+1][j+1]>=1 && g[i][j+1]>=1
			        && g[i][j-1]>=1 && g[i-1][j-1]>=1 && g[i-1][j]>=1 && g[i-1][j+1]>=1)
				{g[i+1][j]=2;
				 g[i+1][j-1]=2;
				 g[i+1][j+1]=2;
				 g[i][j+1]=2;
				 g[i][j-1]=2;
				 g[i-1][j-1]=2;
				 g[i-1][j]=2;
				 g[i-1][j+1]=2;

				}
			}
		}
		boolean NO=false;
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				if (g[i][j]==1) {
					NO=true;
					break;
				}

			}
		}

		if (NO)
			System.out.println("NO");
		else
			System.out.println("YES");
	}

}

/**
 * @author avcbcoder
 * last modified @12-Oct-2018 @3:04:48 PM
 * ACM ICPC (practice) - contests._CF_round_451
 * TODO
 */

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class B {
	public static void main(String[] args) throws Exception {
//		while (true)
			solve();
	}

	// **SOLUTION**
	public static void solve() throws Exception {
		String[] ip = br.readLine().split(" ");
		int n = new Integer(ip[0]);
		int m = new Integer(ip[1]);
		int[][] arr = new int[n][m];

		for (int i = 0; i < arr.length; i++) {
			String s = br.readLine();
			for (int j = 0; j < arr[0].length; j++) {
				if (s.charAt(j) == '#')
					arr[i][j] = 1;
			}
		}

		// for (int[] a : arr)
		// System.out.println(Arrays.toString(a));

		int[][] p = new int[n][m];
		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr[0].length; j++) {
				if (i == 0 || i == arr.length - 1)
					continue;
				if (j == 0 || j == arr[0].length - 1)
					continue;
				if (check2(arr, i, j)) {
					int r = i;
					int c = j;
					p[r - 1][c - 1] = 1;
					p[r - 1][c] = 1;
					p[r - 1][c + 1] = 1;
					p[r][c - 1] = 1;
					p[r][c + 1] = 1;
					p[r + 1][c - 1] = 1;
					p[r + 1][c] = 1;
					p[r + 1][c + 1] = 1;
					// System.out.println("\n\n\n");
					// for (int[] a : p)
					// System.out.println(Arrays.toString(a));
				}
			}
		}
		// System.out.println("\n\n\n");
		// for (int[] a : p)
		// System.out.println(Arrays.toString(a));

		for (int i = 0; i < p.length; i++) {
			for (int j = 0; j < p[0].length; j++) {
				if (arr[i][j] != p[i][j]) {
					System.out.println("NO");
					return;
				}
			}
		}

		System.out.println("YES");
	}

	/**
	 * @param arr
	 * @param i
	 * @param j
	 */
	private static boolean check(int[][] arr, int r, int c) {
		if (arr[r][c + 1] == 1 && arr[r][c - 1] == 1 && arr[c][r + 1] == 1 && arr[c][r - 1] == 1
				&& arr[r + 1][c + 1] == 1 && arr[r - 1][c - 1] == 1 && arr[r - 1][c + 1] == 1
				&& arr[r + 1][c - 1] == 1) {
			return true;
		}
		return false;
	}

	private static boolean check2(int[][] p, int r, int c) {
		if (p[r - 1][c - 1] == 1 && p[r - 1][c] == 1 && p[r - 1][c + 1] == 1 && p[r][c - 1] == 1 && p[r][c + 1] == 1
				&& p[r + 1][c - 1] == 1 && p[r + 1][c] == 1 && p[r + 1][c + 1] == 1)
			return true;
		return false;
	}

	public static InputStreamReader r = new InputStreamReader(System.in);

	public static BufferedReader br = new BufferedReader(r);

	public static Scanner sc = new Scanner(System.in);
}

import java.util.*;

public class forge {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int m = in.nextInt();
    in.nextLine();
    int [][] grid = new int[n][m];
    int [][] newgrid = new int[n][m];
    int[][] newnewgrid = new int[n][m];
    for (int i = 0; i < n; i++) {
      String x = in.nextLine();
      for (int j = 0; j < m; j++) {
        grid[i][j] = (x.charAt(j) == '.') ? 0 : 1;
      }
    }

    for (int i = 1; i < n - 1; i++) {
      for (int j = 1; j < m - 1; j++) {
        int nmarks = 0;
        for (int ii = -1; ii <= 1; ii++) {
          for (int jj = -1; jj <= 1; jj++) {
            if (ii == 0 && jj == 0) {
              continue;
            }

            if (grid[i+ii][j+jj] == 1) {
              nmarks += 1;
            }

          }
        }

        if (nmarks == 8) {
          newgrid[i][j] = 1;
        }
      }
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (newgrid[i][j] == 1) {
          for (int ii = -1; ii <= 1; ii++) {
            for (int jj = -1; jj <= 1; jj++) {
              if (ii == 0 && jj == 0) {
                continue;
              }
              newnewgrid[i+ii][j+jj] = 1;
            }
          }
        }
      }
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (newnewgrid[i][j] != grid[i][j]) {
          System.out.println("NO");
          System.exit(0);
        }
      }
    }
    System.out.println("YES");
  }
}

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

/* abhi2601 */

public class Practice implements Runnable{

    final static long mod = (long)1e9 + 7;

    public void run() {

        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n=sc.nextInt();
        int m=sc.nextInt();
        char a[][]=new char[n][];
        for(int i=0;i<n;i++){
            a[i]=sc.next().toCharArray();
        }
        char b[][]=new char[n][m];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                b[i][j]='.';
            }
        }
        for(int i=0;i<n-2;i++){
            for(int j=0;j<m-2;j++){
                int c=0;
                if(a[i][j]=='#' && a[i][j+1]=='#' && a[i][j+2]=='#' && a[i+1][j]=='#' &&
                        a[i+1][j+2]=='#' && a[i+2][j]=='#' && a[i+2][j+1]=='#' && a[i+2][j+2]=='#'){
                    c++;
                }
                if(c==1){
                    b[i][j]='#'; b[i][j+1]='#';
                    b[i][j+2]='#'; b[i+1][j]='#';
                    b[i+1][j+2]='#'; b[i+2][j]='#';
                    b[i+2][j+1]='#'; b[i+2][j+2]='#';
                }
            }
        }
        int c=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(a[i][j]!=b[i][j]){
                    c++;
                    break;
                }
            }
            if(c!=0) break;
        }
        if(c==0) w.println("YES");
        else w.println("NO");
        w.close();
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

    public static void main(String args[]) throws Exception
    {
        new Thread(null, new Practice(),"cf3",1<<26).start();
    }
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.awt.*;
import java.awt.geom.*;
import java.math.*;
import java.text.*;
import java.math.BigInteger.*;
import java.util.Arrays;

public class   cf514p2
{
  BufferedReader in;
  StringTokenizer as;
  boolean nums[][],nums2[][];
  ArrayList < Integer > [] ar;

  public static void main (String[] args)
  {
    new cf514p2  ();
  }

  public void solve(int a, int b)
  {
    try
    {
      for(int x = -1;x<=1;x++)
      {
        for(int y = -1;y<=1;y++)
        {
          if( ((x != 0) || (y!=0)) && !nums[a+x][b+y])
          {
            return;
          }
        }
      }
      for(int x = -1;x<=1;x++)
      {
        for(int y = -1;y<=1;y++)
        {
          if( ((x != 0) || (y!=0)))
          {
            nums2[a+x][b+y] = true;
          }
        }
      }
    }
    catch(Exception e )
    {

    }
  }

  public cf514p2  ()
  {
    try
    {

      in = new BufferedReader (new InputStreamReader (System.in));
      ArrayList < Integer > [] ar;
      int a = nextInt();
      int b = nextInt();
      nums = new boolean [a][b];
      nums2 = new boolean [a][b];
      for(int x = 0;x<a;x++)
      {
        String c = nextLine();
        for(int x1 = 0;x1<b;x1++)
        {
          if(c.charAt(x1) == '#')
          {
            nums[x][x1] = true;
          }
          else if (c.charAt(x1) == '.')
          {
            nums[x][x1] = false;
          }
        }
      }
      for(int x = 1;x<a-1;x++)
      {
        for(int x1 = 1;x1<b-1;x1++)
        {
          solve(x,x1);
        }
      }
      for(int x = 0;x<a;x++)
      {
        for(int x1 = 0;x1<b;x1++)
        {
          if(nums2[x][x1] != nums[x][x1])
          {
            System.out.println("NO");
            System.exit(0);
          }
        }
      }
      System.out.println("YES");
    }

    catch(IOException e)
    {
      System.out.println("NO");
    }
  }

  String next () throws IOException
  {
    while (as == null || !as.hasMoreTokens ())
    {
      as = new StringTokenizer (in.readLine ().trim ());
    }

    return as.nextToken ();
  }

  long nextLong () throws IOException
  {
    return Long.parseLong (next ());
  }

  int nextInt () throws IOException
  {
    return Integer.parseInt (next ());
  }

  double nextDouble () throws IOException
  {
    return Double.parseDouble (next ());
  }

  String nextLine () throws IOException
  {
    return in.readLine ().trim ();
  }
}

import java.util.*;
import java.io.*;

public class Main {

	public static int mod = 1000000007;

	static boolean f(char a[][],int n,int m,int x,int y){
        if(x>=1 && x<=n-2 && y>=1 && y<=m-2){
            if(a[x-1][y]=='#' && a[x][y-1]=='#' && a[x-1][y-1]=='#' && a[x+1][y]=='#' && a[x][y+1]=='#' && a[x+1][y+1]=='#' && a[x-1][y+1]=='#'  && a[x+1][y-1]=='#')return true;
        }
        return false;
    }

    public static void solve(InputReader in) {

        int n=in.readInt();
        int m=in.readInt();
        char a[][]=new char[n][m];
        for(int i=0;i<n;i++){
            a[i]=in.readString().toCharArray();
        }

        for (int i = 0; i <n ; i++) {
            for (int j = 0; j <m ; j++) {
                if(a[i][j]=='#'){
                    boolean ff=f(a,n,m,i-1,j)||f(a,n,m,i,j-1)||f(a,n,m,i+1,j)||f(a,n,m,i,j+1)||f(a,n,m,i-1,j-1)||f(a,n,m,i+1,j+1)||f(a,n,m,i-1,j+1)||f(a,n,m,i+1,j-1);
                    if(ff==false){
                        System.out.println("NO");
                        return;
                    }
                }
            }
        }
       System.out.println("YES");

    }

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		int t = 1;
		while (t-- > 0)
			solve(in);
	}
}

class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

    public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class pair implements Comparable<pair> {
	long first;
	long second;

	pair(long a, long b) {
		this.first = a;
		this.second = b;
	}

	public long getFirst() {
		return first;
	}

	public long getSecond() {
		return second;
	}

	public String toString() {
		return first + " " + second;
	}

	public boolean equals(Object o) {
		return o instanceof pair && ((pair) o).first == first && ((pair) o).second == second;
	}

	public int compareTo(pair a) {
		return Long.compare(first, a.first);
	}

	public int hashCode() {
		return (31 * (int) first + (int) second);
	}
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class templ implements Runnable {
    class pair
    {
        int f,s;
        pair(int fi,int se)
        {
            f=fi;
            s=se;
        }
    }
    static int binarySearch(int arr[], int l, int r, int x)
    {
        if (r >= l)
        {
            int mid = l + (r - l)/2;
            if (arr[mid] == x)
                return mid;
            if (arr[mid] > x)
                return binarySearch(arr, l, mid-1, x);
            return binarySearch(arr, mid+1, r, x);
        }
        return -1;
    }
    void merge1(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i]<=R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort1(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort1(arr, l, m);
            sort1(arr , m+1, r);
            merge1(arr, l, m, r);
        }
    }
    void merge3(int arr[],int arr1[],int arr2[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        //long L3[]=new long[n1];
        //long R3[]=new long[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            //L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            //R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                //arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                //arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            //arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            //arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort3(int arr[],int arr1[],int arr2[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort3(arr,arr1,arr2, l, m);
            sort3(arr ,arr1,arr2, m+1, r);
            merge3(arr,arr1,arr2,l, m, r);
        }
    }
    void merge2(int arr[],int arr1[],int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            j++;
            k++;
        }
    }
    void sort2(int arr[],int arr1[],int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort2(arr,arr1, l, m);
            sort2(arr ,arr1, m+1, r);
            merge2(arr,arr1,l, m, r);
        }
    }
    void merge4(int arr[],int arr1[],int arr2[],int arr3[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        int L3[]=new int[n1];
        int R3[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort4(int arr[],int arr1[],int arr2[],int arr3[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort4(arr,arr1,arr2,arr3, l, m);
            sort4(arr ,arr1,arr2,arr3, m+1, r);
            merge4(arr,arr1,arr2,arr3,l, m, r);
        }
    }
    public int justsmall(long a[],int l,int r,long x)
    {
        int p=-1;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<=x)
            {
                p=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        return p;
    }
    public int justlarge(long a[],int l,int r,long x)
    {
        int p=0;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<x)
            {
                l=mid+1;
            }
            else
            {
                p=mid;
                r = mid - 1;
            }
        }
        return p;
    }
    long gcd(long x,long y)
    {
        if(x%y==0)
            return y;
        else
            return(gcd(y,x%y));
    }
    int fact(int n)
    {
        int ans=1;
        for(int i=1;i<=n;i++)
            ans*=i;
        return ans;
    }
    long bintoint(String s)
    {
        long a=0;
        int l=s.length();
        int k=0;
        for(int i=l-1;i>=0;i--)
        {
            char c=s.charAt(i);
            if(c=='1')
            {
                a=a+(long)Math.pow(2,k);
            }
            k++;
        }
        return a;
    }
    String inttobin(long x)
    {
        String s="";
        while(x!=0)
        {
            long k=x%2;
            if(k==1)
                s="1"+s;
            else
                s="0"+s;
            x=x/2;
        }
        return s;
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new templ(),"templ",1<<26).start();
    }
    public void run() {
        try {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int n=in.ni();
            int m=in.ni();
            int a[][]=new int[n+2][m+2];
            int b[][]=new int[n+2][m+2];
            for(int i=1;i<=n;i++)
            {
                String s=in.nextLine();
                for(int j=0;j<m;j++)
                {
                    char c=s.charAt(j);
                    if(c=='#')
                        a[i][j+1]=1;
                    else
                        a[i][j+1]=0;
                }
            }
            int k=0;
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)
                {
                    if(a[i][j]==0)
                        continue;
                    if(a[i][j+1]==1&&a[i][j+2]==1&&a[i+1][j]==1&&a[i+1][j+2]==1&&a[i+2][j]==1&&a[i+2][j+1]==1&&a[i+2][j+2]==1)
                    {
                        b[i][j]=1;
                        b[i][j+1]=1;
                        b[i][j+2]=1;
                        b[i+1][j]=1;
                        b[i+1][j+2]=1;
                        b[i+2][j]=1;
                        b[i+2][j+1]=1;
                        b[i+2][j+2]=1;
                    }
                }
            }
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)
                {
                    if(a[i][j]==1&&b[i][j]!=1)
                    {
                        k=1;
                        break;
                    }
                }
            }
            if(k==0)
                out.println("YES");
            else
                out.println("NO");
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }
}

import java.sql.SQLOutput;
import java.util.Scanner;

public class ProblemB {

    static int arr[];
    static boolean ans[];
    static boolean flag[];
    static int size;

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        char[][] arr = new char[n+2][m+2];
        boolean[][] flag = new boolean [n+2][m+2];
        for(int i=1;i<=n;i++) {
            String s = sc.next();
            for(int j=1;j<=m;j++) {
                arr[i][j] = s.charAt(j-1);
            }
        }
        for(int i=2;i<=n-1;i++) {
            for(int j=2;j<=m-1;j++) {
                if(arr[i-1][j-1] == '#' && arr[i-1][j] == '#' && arr[i-1][j+1] == '#' &&
                        arr[i][j-1] == '#' && arr[i][j+1] == '#' &&
                        arr[i+1][j-1] == '#' && arr[i+1][j] == '#' && arr[i+1][j+1] == '#') {
                    flag[i-1][j-1] = true;
                    flag[i-1][j] = true;
                    flag[i-1][j+1] = true;
                    flag[i][j-1] = true;
                    flag[i][j+1] = true;
                    flag[i+1][j-1] = true;
                    flag[i+1][j] = true;
                    flag[i+1][j+1] = true;
                }
            }
        }
        boolean ans = true;
        for(int i=1;i<=n;i++) {
            for (int j = 1; j <= m; j++) {
                if(!flag[i][j] && arr[i][j] == '#') {
                    ans = false;
                    break;
                }
            }
        }
        if(ans) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.io.*;
import java.lang.reflect.Field;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        new Main();
    }

    Main() throws IOException {
        solve();
    }

    void solve() throws IOException {
        int n = Reader.nextInt();
        int m = Reader.nextInt();
        boolean[][] inked = new boolean[n][m];
        for(int i = 0; i < n; i++){
            String x = Reader.next();
            for(int j = 0; j < m; j++){
                if(x.charAt(j) == '#'){inked[i][j] = true;}
                else{inked[i][j] = false;}
            }
        }
        boolean[][] sig = new boolean[n][m];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if(inked[i][j]){
                    if( i-1 > 0){
                        if(j-1 > 0){ unink(i-1, j-1, inked, sig);}
                        if(j+1 < m-1){unink(i-1, j+1, inked, sig);}
                    }
                    if(i+1 < n-1){
                        if(j-1 > 0){ unink(i+1, j-1, inked, sig);}
                        if(j+1 < m-1){unink(i+1, j+1, inked, sig);}
                    }
                }
            }
        }
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if(inked[i][j] != sig[i][j]){System.out.println("NO"); return;}
            }
        }
        System.out.println("YES");
    }

    void unink(int i, int j, boolean[][] grid, boolean[][] grid1){
        if(grid[i-1][j-1] && grid[i-1][j] && grid[i-1][j+1] && grid[i][j+1] && grid[i][j-1] && grid[i+1][j-1] && grid[i+1][j] && grid[i+1][j+1])
        {grid1[i-1][j-1] = grid1[i-1][j] = grid1[i-1][j+1] = grid1[i][j+1] = grid1[i][j-1] = grid1[i+1][j-1] = grid1[i+1][j] = grid1[i+1][j+1] = true;}
    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");

    }

    static String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {

                tokenizer = new StringTokenizer(reader.readLine());

            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    static String next() throws IOException {

        while ( ! tokenizer.hasMoreTokens() ) {

            tokenizer = new StringTokenizer(

                    reader.readLine() );

        }
        return tokenizer.nextToken();

    }

    static int nextInt() throws IOException {

        return Integer.parseInt( next() );

    }

    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }

    static long nextLong() {

        return Long.parseLong(nextToken());
    }
}

import java.util.*;
import java.awt.Point;
import java.math.*;
import java.io.*;
@SuppressWarnings("unused")
public class implementation {int[] b;	String g="";int c=0;int M=1000000000+7;ArrayList<Integer> list=new ArrayList<Integer>();String s;int[] size;int[] id;
int[]ab;int[] data;int mod=100000;LinkedList<Integer> queue=new LinkedList<Integer>();int dis=0;int max=0;ArrayList<Integer>[] arr;
	public static void main(String[] args)  {
                new implementation().solve();
                                  }
	long[] fact;long[] inv;
            public void solve(){
            	int n=sc.nextInt();
            	int m=sc.nextInt();char[][] arr=new char[n+2][m+2];
            	int[][] brr=new int[n+2][m+2];
            	for(int i=0;i<n+2;i++) {
            		for(int j=0;j<m+2;j++) {
            			if(i==0||i==n+1)
            				brr[i][j]=-1;
            			if(j==0||j==m+1)
            				brr[i][j]=-1;
            		}
            	}
            			for(int i=1;i<=n;i++) {
            		String s=sc.next();
            		for(int j=1;j<=m;j++) {
            			arr[i][j]=s.charAt(j-1);
            			if(arr[i][j]=='#')
            				c++;
            		}
            	}
            			if(c==n*m) {
            				if(n==3&&m==3)
            					System.out.println("NO");
            				else
            					System.out.println("YES");
            			}
            			else {
            				for(int i=1;i<n+1;i++) {
            					for(int j=1;j<m+1;j++) {
            						if(i==1||i==n||j==1||j==m)
            							brr[i][j]=-1;
            					}
            				}
            				for(int i=1;i<n+1;i++) {
            					for(int j=1;j<=m;j++) {

            						if(arr[i][j]=='.') {
            							brr[i][j+1]=-1;brr[i][j-1]=-1;brr[i+1][j]=-1;brr[i-1][j]=-1;
            							brr[i+1][j+1]=-1;brr[i-1][j-1]=-1;brr[i-1][j+1]=-1;brr[i+1][j-1]=-1;
            						}
            					}
            				}int g=0;

            				for(int i=1;i<n+1;i++) {
            					for(int j=1;j<m+1;j++) {
            						if(arr[i][j]=='#') {
            							if(brr[i][j+1]==-1&&brr[i][j-1]==-1&&brr[i+1][j]==-1&&brr[i-1][j]==-1&&
            							brr[i+1][j+1]==-1&&brr[i-1][j-1]==-1&&brr[i-1][j+1]==-1&&brr[i+1][j-1]==-1) {
            								g++;break;}
            						}
            					}
            					if(g==1)
            						break;
            				}

            				if(g==0)
            					System.out.println("YES");
            				else
            					System.out.println("NO");
            			}

            }

         /*  static final int MAXN = 15000000+1;

            // stores smallest prime factor for every number
            static int spf[] = new int[MAXN];

            // Calculating SPF (Smallest Prime Factor) for every
            // number till MAXN.
            // Time Complexity : O(nloglogn)

            static void sieve()
            {
                spf[1] = 1;
                for (int i=2; i<MAXN; i++)

                    // marking smallest prime factor for every
                    // number to be itself.
                    spf[i] = i;

                // separately marking spf for every even
                // number as 2
                for (int i=4; i<MAXN; i+=2)
                    spf[i] = 2;

                for (int i=3; i*i<MAXN; i++)
                {
                    // checking if i is prime
                    if (spf[i] == i)
                    {
                        // marking SPF for all numbers divisible by i
                        for (int j=i*i; j<MAXN; j+=i)

                            // marking spf[j] if it is not
                            // previously marked
                            if (spf[j]==j)
                                spf[j] = i;
                    }
                }
            }

            static int gcd(int a, int b)
            {
              if (b == 0)
                return a;
              return gcd(b, a % b);
            }

            public class Node{
       	     int x;int color;int y;
       	       Node par;
       	        public Node(int a,int b) {
       	          	x=a;color=b;

       	             }
                         }
                     class sortbyweight implements Comparator<Integer>{

					@Override
					public int compare(Integer a, Integer b) {

       					if(a<b)
                			return -1;
                		else
                			return 1;
					}}*/

       				 FastReader sc=new FastReader();
       				 static class FastReader
       				     {
       				         BufferedReader br;
       				         StringTokenizer st;

       				         public FastReader()
       				         {
       				             br = new BufferedReader(new
       				                      InputStreamReader(System.in));
       				         }

       				         String next()
       				         {
       				             while (st == null || !st.hasMoreElements())
       				             {
       				                 try
       				                 {
       				                     st = new StringTokenizer(br.readLine());
       				                 }
       				                 catch (IOException  e)
       				                 {
       				                     e.printStackTrace();
       				                 }
       				             }
       				             return st.nextToken();
       				         }

       				         int nextInt()
       				         {
       				             return Integer.parseInt(next());
       				         }

       				         long nextLong()
       				         {
       				             return Long.parseLong(next());
       				         }

       				         double nextDouble()
       				         {
       				             return Double.parseDouble(next());
       				         }

       				         String nextLine()
       				         {
       				             String str = "";
       				             try
       				             {
       				                 str = br.readLine();
       				             }
       				             catch (IOException e)
       				             {
       				                 e.printStackTrace();
       				             }
       				             return str;
       				         }
       				     }}

/* Author: Ronak Agarwal, reader part not written by me*/
import java.io.* ; import java.util.* ;
import static java.lang.Math.min ; import static java.lang.Math.max ;
import static java.lang.Math.abs ; import static java.lang.Math.log ;
import static java.lang.Math.pow ; import static java.lang.Math.sqrt ;
/* Thread is created here to increase the stack size of the java code so that recursive dfs can be performed */
public class Codeshefcode{
	public static void main(String[] args) throws IOException{
		new Thread(null,new Runnable(){	public void run(){ exec_Code() ;} },"Solver",1l<<27).start() ;
	}
	static void exec_Code(){
		try{
			Solver Machine = new Solver() ;
			Machine.Solve() ; Machine.Finish() ;}
		catch(Exception e){ e.printStackTrace() ; print_and_exit() ;}
		catch(Error e){ e.printStackTrace() ; print_and_exit() ; }
	}
	static void print_and_exit(){ System.out.flush() ; System.exit(-1) ;}
}
/* Implementation of the Reader class */
class Reader {
	private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar,numChars;
	public Reader() { this(System.in); }
	public Reader(InputStream is) { mIs = is;}
	public int read() {
		if (numChars == -1) throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}
			if (numChars <= 0) return -1;
		}
		return buf[curChar++];
	}
	public String nextLine(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString() ;
	}
	public String s(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		}while (!isSpaceChar(c));
		return res.toString();
	}
	public long l(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		long res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read();
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public int i(){
		int c = read() ;
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		int res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read() ;
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public void readL(long arr[],int l,int r){
		for(int i=l ; i<=r ; i++) arr[i] = l();
	}
	public void readI(int arr[],int l,int r){
		for(int i=l ; i<=r ; i++) arr[i] = i();
	}
	public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
	public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
}
/* All the useful functions,constants,renamings are here*/
class Template{
	/* Constants Section */
	final int INT_MIN = Integer.MIN_VALUE ; final int INT_MAX = Integer.MAX_VALUE ;
	final long LONG_MIN = Long.MIN_VALUE ; final long LONG_MAX = Long.MAX_VALUE ;
	static long MOD = 1000000007 ;
	static Reader ip = new Reader() ;
	static PrintWriter op = new PrintWriter(System.out) ;
	/* Methods for writing */
	static void p(Object o){ op.print(o) ; }
	static void pln(Object o){ op.println(o) ;}
	static void Finish(){ op.flush(); op.close(); }
	/* Implementation of operations modulo MOD */
	static long inv(long a){ return powM(a,MOD-2) ; }
	static long m(long a,long b){ return (a*b)%MOD ; }
	static long d(long a,long b){ return (a*inv(b))%MOD ; }
	static long powM(long x,long n){
		if(n<0) return powM(inv(x),-n) ;
		long y=1 ;
		for( ; n!=0 ; x=(x*x)%MOD , n/=2) if((n&1)==1) y = (y*x)%MOD ;
		return y ;
	}
	/* Renaming of some generic utility classes */
	final static class mylist extends ArrayList<Integer>{}
	final static class myset extends TreeSet<pair>{}
	final static class mystack extends Stack<Integer>{}
	final static class mymap extends TreeMap<Long,Integer>{}
}
/* Implementation of the pair class, useful for every other problem */
class pair implements Comparable<pair>{
	int x ; int y ;
	pair(int _x,int _y){ x=_x ; y=_y ;}
	public int compareTo(pair p){
		return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ;
	}
}
/* Main code starts here */
class Solver extends Template{
	int n,m;
	boolean check(int i,int j){
		return (i>=1 && i<=n && j>=1 && j<=m);
	}
	public void Solve() throws IOException{
		n = ip.i(); m = ip.i();
		int mat[][] = new int[n+1][m+1];
		for(int i=1 ; i<=n ; i++){
			char c[] = ip.s().toCharArray();
			for(int j=1 ; j<=m ; j++) mat[i][j] = (c[j-1]=='#' ? 1 : 0);
		}
		int nA[][] = new int[n+1][m+1];
		int nmat[][] = new int[n+1][m+1];
		for(int i=1 ; i<=n ; i++)
			for(int j=1 ; j<=m ; j++){
				if(i<=1 || j<=1 || i>=n || j>=m) nA[i][j]=1;
				if(mat[i][j]==0){
					for(int di=-1 ; di<=1 ; di++)
						for(int dj=-1 ; dj<=1 ; dj++){
							int ii = i+di; int jj = j+dj;
							if(ii==i && jj==j) continue;
							if(check(ii,jj)) nA[ii][jj]=1;
						}
				}
			}
		// for(int i=1 ; i<=n ; i++){
		// 	for(int j=1 ; j<=m ; j++) p(nA[i][j]+" ");
		// 	pln("");
		// }
		// pln("");
		for(int i=1 ; i<=n ; i++)
			for(int j=1 ; j<=m ; j++) if(nA[i][j]==0){
				for(int di=-1 ; di<=1 ; di++)
					for(int dj=-1 ; dj<=1 ; dj++){
						int ii = i+di; int jj = j+dj;
						if((ii==i) && (jj==j)) continue;
						if(check(ii,jj)) nmat[ii][jj]=1;
					}
			}
		// for(int i=1 ; i<=n ; i++){
		// 	for(int j=1 ; j<=m ; j++) p(nmat[i][j]+" ");
		// 	pln("");
		// }
		for(int i=1 ; i<=n ; i++) for(int j=1 ; j<=m ; j++) if(nmat[i][j]!=mat[i][j]){
			pln("NO");
			return;
		}
		pln("YES");
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Solution {
    private static int[] dx = {
            -1, -1, -1,
            0, 0,
            1, 1, 1};
    private static int[] dy = {
            -1, 0, 1,
            -1, 1,
            -1, 0, 1};

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

        int r = in.nextInt();
        int c = in.nextInt();
        boolean[][] m = new boolean[r + 1][c + 1];
        boolean[][] inp = new boolean[r + 1][c + 1];
        for (int i = 0; i < r; i++) {
            String s = in.next();
            //System.out.println(m[i]);
            for (int j = 0; j < s.length(); j++) {
                if (s.charAt(j) == '#') {
                    m[i][j] = true;
                    inp[i][j] = true;
                }
            }
        }

        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                if (canPress(i, j, r, c, inp)) {

                    // make press
                    for (int k = 0; k < 8; k++) {
                        int xi = i + dx[k];
                        int yi = j + dy[k];
                        m[xi][yi] = false;
                    }

                }
            }
        }
        boolean isLeftAny = false;
        for (int i = 0; i < r && !isLeftAny; i++) {
            for (int j = 0; j < c && !isLeftAny; j++) {
                if (m[i][j]) {
                    isLeftAny = true;
                    break;
                }
            }
        }
        if(isLeftAny){
            System.out.println("NO");
        }else{
            System.out.println("YES");
        }
    }

    private static boolean canPress(int x, int y, int r, int c, boolean[][] inp) {
        for (int i = 0; i < 8; i++) {
            int xi = x + dx[i];
            int yi = y + dy[i];
            if (xi < 0 || yi < 0) {
                return false;
            }
            if (xi >= r || yi >= c) {
                return false;
            }
            if(!inp[xi][yi]){
                return false;
            }
        }
        return true;
    }
}

import java.util.Scanner;

public class forgery
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int arr[][]=new int[n][m];
        sc.nextLine();
        int flag=0;
        for(int i=0;i<n;i++)
        {
            String a=sc.nextLine();
            for(int j=0;j<a.length();j++)
            {
                if(a.charAt(j)=='.')
                    arr[i][j]=0;
                if(a.charAt(j)=='#')
                    arr[i][j]=1;
            }
        }
        for(int i=1;i<n-1;i++)
        {
            for(int j=1;j<m-1;j++)
            {
                if(arr[i-1][j-1]!=0 && arr[i-1][j]!=0 && arr[i-1][j+1]!=0 && arr[i][j-1]!=0 && arr[i][j+1]!=0 && arr[i+1][j-1]!=0 && arr[i+1][j]!=0 && arr[i+1][j+1]!=0)
                {
                    arr[i-1][j-1]=2;
                    arr[i-1][j]=2;
                    arr[i-1][j+1]=2;
                    arr[i][j-1]=2;
                    arr[i][j+1]=2;
                    arr[i+1][j-1]=2;
                    arr[i+1][j]=2;
                    arr[i+1][j+1]=2;
                }

            }
            if(flag==1)
                break;
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                if(arr[i][j]==1)
                {
                    flag=1;
                    break;
                }
            }
        }
        if(flag==1)
            System.out.print("NO");
        else
            System.out.print("YES");
        sc.close();
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Task2 {
    static  int n,m;

    static boolean val(int r,int c ){
        int i=0;
        if (r >= 0 && r < n && c < m && c >= 0) {
            i++;
        }
        if (r >= 0 && r < n && c+1 < m && c+1 >= 0) {
            i++;
        }
        if (r >= 0 && r < n && c+2 < m && c+2 >= 0) {
            i++;
        }
        if (r+1 >= 0 && r+1 < n && c < m && c >= 0) {
            i++;
        }
        if (r+2 >= 0 && r+2 < n && c < m && c >= 0) {
           i++;
        }
        if (r+1 >= 0 && r+1 < n && c+1 < m && c+1 >= 0) {
            i++;
        }
        if (r+1 >= 0 && r+1 < n && c+2 < m && c+2 >= 0) {
            i++;
        }
        if (r+2 >= 0 && r+2 < n && c+1 < m && c+1 >= 0) {
            i++;
        }
        if (r+2 >= 0 && r+2 < n && c+2 < m && c+2 >= 0) {
           i++;
        }
        if (i==9)return true;
        return false;
    }
    static boolean nof(int r,int c,char[][]b){
        if (b[r][c]=='.')return true;
        if (b[r][c+1]=='.')return true;
        if (b[r][c+2]=='.')return true;
        if (b[r+1][c]=='.')return true;
        if (b[r+1][c+2]=='.')return true;
        if (b[r+2][c]=='.')return true;
        if (b[r+2][c+1]=='.')return true;
        if (b[r+2][c+2]=='.')return true;

        return false;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
         n = in.nextInt();m= in.nextInt();
        char[][] a= new char[n][m],b= new char[n][m];

        for (int i = 0; i < n; i++) {
            Arrays.fill(b[i],'.');
        }

        for (int i =0;i<n;++i){
            a[i]=in.next().toCharArray();
        }
        for (int i =0;i<n;++i){
            for (int k =0;k<m;++k){
                if (val(i,k)&&a[i][k]=='#'&&nof(i,k,b)&&!nof(i,k,a)){
                    b[i][k]='#';
                    b[i][k+1]='#';
                    b[i][k+2]='#';
                    b[i+1][k]='#';
                    b[i+1][k+2]='#';
                    b[i+2][k]='#';
                    b[i+2][k+1]='#';
                    b[i+2][k+2]='#';

                }
            }
        }

        for (int i = 0; i < n; i++) {
            for (int k = 0; k < m; k++) {
                if (a[i][k]!=b[i][k]){
                    System.out.println("NO");return;
                }
            }
        }

        System.out.println("YES");

    }
}

import java.io.*;
import java.util.NoSuchElementException;

public class Main_1059B {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		int m = sc.nextInt();

		char[][] s = new char[n][];
		for (int i = 0; i < n; i++) {
			s[i] = sc.next().toCharArray();
		}

		// 8近傍
		int[] dx8 = { 1, 1, 0, -1, -1, -1, 0, 1 };
		int[] dy8 = { 0, 1, 1, 1, 0, -1, -1, -1 };

		boolean[][] w = new boolean[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (s[i][j] == '#') {
					continue;
				}

				for (int k = 0; k < 8; k++) {
					int ni = i + dy8[k];
					int nj = j + dx8[k];
					if (ni < 1 || ni >= n - 1 || nj < 1 || nj >= m - 1) {
						continue;
					}

					w[ni][nj] = true;
				}
			}
		}

		char[][] tmp = new char[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				tmp[i][j] = '.';
			}
		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {
				if (w[i][j]) {
					continue;
				}

				for (int k = 0; k < 8; k++) {
					int ni = i + dy8[k];
					int nj = j + dx8[k];

					tmp[ni][nj] = '#';
				}
			}
		}

		for (int i = 0; i < n; i++) {
			String s1 = new String(s[i]);
			String s2 = new String(tmp[i]);

			if (!s1.equals(s2)) {
				pr.println("NO");
				return;
			}
		}

		pr.println("YES");
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	static class Scanner {
		BufferedReader br;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		private boolean isPrintable(int ch) {
			return ch >= '!' && ch <= '~';
		}

		private boolean isCRLF(int ch) {
			return ch == '\n' || ch == '\r' || ch == -1;
		}

		private int nextPrintable() {
			try {
				int ch;
				while (!isPrintable(ch = br.read())) {
					if (ch == -1) {
						throw new NoSuchElementException();
					}
				}

				return ch;
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		String next() {
			try {
				int ch = nextPrintable();
				StringBuilder sb = new StringBuilder();
				do {
					sb.appendCodePoint(ch);
				} while (isPrintable(ch = br.read()));

				return sb.toString();
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		int nextInt() {
			try {
				// parseInt from Integer.parseInt()
				boolean negative = false;
				int res = 0;
				int limit = -Integer.MAX_VALUE;
				int radix = 10;

				int fc = nextPrintable();
				if (fc < '0') {
					if (fc == '-') {
						negative = true;
						limit = Integer.MIN_VALUE;
					} else if (fc != '+') {
						throw new NumberFormatException();
					}
					fc = br.read();
				}
				int multmin = limit / radix;

				int ch = fc;
				do {
					int digit = ch - '0';
					if (digit < 0 || digit >= radix) {
						throw new NumberFormatException();
					}
					if (res < multmin) {
						throw new NumberFormatException();
					}
					res *= radix;
					if (res < limit + digit) {
						throw new NumberFormatException();
					}
					res -= digit;

				} while (isPrintable(ch = br.read()));

				return negative ? res : -res;
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		long nextLong() {
			try {
				// parseLong from Long.parseLong()
				boolean negative = false;
				long res = 0;
				long limit = -Long.MAX_VALUE;
				int radix = 10;

				int fc = nextPrintable();
				if (fc < '0') {
					if (fc == '-') {
						negative = true;
						limit = Long.MIN_VALUE;
					} else if (fc != '+') {
						throw new NumberFormatException();
					}
					fc = br.read();
				}
				long multmin = limit / radix;

				int ch = fc;
				do {
					int digit = ch - '0';
					if (digit < 0 || digit >= radix) {
						throw new NumberFormatException();
					}
					if (res < multmin) {
						throw new NumberFormatException();
					}
					res *= radix;
					if (res < limit + digit) {
						throw new NumberFormatException();
					}
					res -= digit;

				} while (isPrintable(ch = br.read()));

				return negative ? res : -res;
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		float nextFloat() {
			return Float.parseFloat(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			try {
				int ch;
				while (isCRLF(ch = br.read())) {
					if (ch == -1) {
						throw new NoSuchElementException();
					}
				}
				StringBuilder sb = new StringBuilder();
				do {
					sb.appendCodePoint(ch);
				} while (!isCRLF(ch = br.read()));

				return sb.toString();
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = sc.nextInt();
			}

			return ret;
		}

		int[][] nextIntArrays(int n, int m) {
			int[][] ret = new int[m][n];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					ret[j][i] = sc.nextInt();
				}
			}

			return ret;
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new NoSuchElementException();
			}
		}
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}

		void printInts(int... a) {
			StringBuilder sb = new StringBuilder(32);
			for (int i = 0, size = a.length; i < size; i++) {
				if (i > 0) {
					sb.append(' ');
				}
				sb.append(a[i]);
			}

			println(sb);
		}

		void printLongs(long... a) {
			StringBuilder sb = new StringBuilder(64);
			for (int i = 0, size = a.length; i < size; i++) {
				if (i > 0) {
					sb.append(' ');
				}
				sb.append(a[i]);
			}

			println(sb);
		}

		void printStrings(String... a) {
			StringBuilder sb = new StringBuilder(32);
			for (int i = 0, size = a.length; i < size; i++) {
				if (i > 0) {
					sb.append(' ');
				}
				sb.append(a[i]);
			}

			println(sb);
		}
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class b1 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		new b1().solve(in);
		in.close();
	}

	char[][] stamp = {{'#', '#', '#'},{'#', '.', '#'},{'#', '#', '#'}};
	private void solve(Scanner in) {
		int N = in.nextInt();
		int M = in.nextInt();
		char[][] grid = new char[N][M];
		for(int i=0; i<N; i++) {
			String line = in.next();
			for(int j=0; j<M; j++) {
				grid[i][j] = line.charAt(j);
			}
		}
		char[][] newGrid = new char[N][M];
		for(int i=0; i<N; i++) Arrays.fill(newGrid[i], '.');
		for(int i=0; i<N-2; i++) {
			for(int j=0; j<M-2; j++) {
				boolean good = true;
				for(int a=0; a<3; a++) {
					for(int b=0; b<3; b++) {
						if(grid[i+a][j+b]=='.' && stamp[a][b]=='#') {
							good = false;
						}
					}
				}
				if(good) {
					for(int a=0; a<3; a++) {
						for(int b=0; b<3; b++) {
							if(newGrid[i+a][j+b]!='#')
								newGrid[i+a][j+b]=stamp[a][b];
						}
					}
				}

			}
		}

		boolean ans = true;
		outer: for(int i=0; i<N; i++) {
			for(int j=0; j<M; j++) {
				if(grid[i][j]!=newGrid[i][j]) {
					ans = false;
					break outer;
				}
			}
		}
		System.out.println(ans?"YES":"NO");

	}
}

import java.io.IOException;
import java.util.Scanner;

public class P6 {

	static class Coord {
		public int row, col;

		public Coord(int row, int col) {
			this.row = row;
			this.col = col;
		}

		@Override
		public String toString() {
			return "[" + row + ", " + col + "]";
		}
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			System.out.println(solve(scanner));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static String solve(Scanner scanner) throws IOException {
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		scanner.nextLine();
		char[][] signature = new char[n][m];
		int currLine = 0;
		while (scanner.hasNextLine()) {
			String line = scanner.nextLine();
			signature[currLine] = line.toCharArray();
			currLine++;
		}

		// Início da lógica

		char[][] paper = new char[n][m];
		for (int row = 0; row < n; row++) {
			for (int col = 0; col < m; col++) {
				paper[row][col] = '.';
			}
		}

		Coord nextPlaceToDraw = findNextPlaceToDraw(new Coord(0, -1), signature);
		while (nextPlaceToDraw != null) {
			draw(nextPlaceToDraw, paper, signature);
			nextPlaceToDraw = findNextPlaceToDraw(nextPlaceToDraw, signature);
		}
		return isEqual(paper, signature) ? "YES" : "NO";
	}

	public static Coord findNextPlaceToDraw(Coord current, char[][] signature) {
		for (int row = current.row; row < signature.length - 2; row++) {
			for (int col = (row == current.row ? current.col + 1 : 0); col < signature[row].length - 2; col++) {
				if (signature[row][col] == '#') {
					return new Coord(row, col);
				}
			}
		}
		return null;
	}

	public static boolean canDraw(Coord place, char[][] paper) {
		boolean v1 = paper[place.row][place.col] == '#';
		boolean v2 = paper[place.row][place.col + 1] == '#';
		boolean v3 = paper[place.row][place.col + 2] == '#';

		boolean v4 = paper[place.row + 1][place.col] == '#';
		boolean v5 = paper[place.row + 1][place.col + 2] == '#';

		boolean v6 = paper[place.row + 2][place.col] == '#';
		boolean v7 = paper[place.row + 2][place.col + 1] == '#';
		boolean v8 = paper[place.row + 2][place.col + 2] == '#';
		return v1 && v2 && v3 && v4 && v5 && v6 && v7 && v8;
	}

	public static void draw(Coord place, char[][] paper, char[][] signature) {
		if (canDraw(place, signature)) {

			paper[place.row][place.col] = '#';
			paper[place.row][place.col + 1] = '#';
			paper[place.row][place.col + 2] = '#';

			paper[place.row + 1][place.col] = '#';
			paper[place.row + 1][place.col + 2] = '#';

			paper[place.row + 2][place.col] = '#';
			paper[place.row + 2][place.col + 1] = '#';
			paper[place.row + 2][place.col + 2] = '#';
		}
	}

	public static boolean isEqual(char[][] paper1, char[][] paper2) {
		for (int row = 0; row < paper1.length; row++) {
			for (int col = 0; col < paper1[row].length; col++) {
				if (paper1[row][col] != paper2[row][col]) {
					return false;
				}
			}
		}
		return true;
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	static class Reader {
		static BufferedReader br;
		static StringTokenizer st;

		public Reader() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}

		public int nextInt() throws Exception {
			if (st == null || !st.hasMoreTokens())
				readLine();
			return Integer.parseInt(st.nextToken());
		}

		public Long nextLong() throws Exception {
			if (st == null || !st.hasMoreTokens())
				readLine();
			return Long.parseLong(st.nextToken());
		}

		public String next() throws Exception {
			if (st == null || !st.hasMoreTokens())
				readLine();
			return st.nextToken();
		}

		public static void readLine() throws Exception {
			st = new StringTokenizer(br.readLine());
		}
	}

	static int n;
	static int m;

	public static void main(String[] args) throws Exception {
		Reader in = new Reader();
		n = in.nextInt();
		m = in.nextInt();
		int[][] toForm = new int[n][m];
		for (int i = 0; i < n; i++) {
			String val = in.next();
			for (int j = 0; j < m; j++) {
				toForm[i][j] = val.charAt(j) == '.' ? 0 : 1;
			}
		}
		int[][] bestMatch = new int[n][m];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				bestMatch[i][j] = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				boolean ok = true;
				for(int k = -1; k<=1; k++)
					for(int l = -1; l<=1; l++)
						if(l!=k||k!=0)
							if(!isMarked(toForm, i+k, j+l))
								ok = false;
				if(ok)
				for(int k = -1; k<=1; k++)
					for(int l = -1; l<=1; l++)
						if(l!=0||k!=0) mark(bestMatch, i+k, j+l);
			}
		}
		boolean ok = true;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if(bestMatch[i][j]!=toForm[i][j]) ok = false;
		System.out.println(ok?"YES":"NO");
	}

	public static boolean isMarked(int[][] ar, int i, int j) {
		if (i >= 0 && i < n && j >= 0 && j < m&&ar[i][j] == 1)
			return true;
		return false;
	}

	public static void mark(int[][] ar, int i, int j) {
		if (i >= 0 && i < n && j >= 0 && j < m)
			ar[i][j] = 1;
	}
}

/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    static char c[][];
    static int n,m;
    static boolean painted[][];
    public static void main(String[] args) {
        new Thread(null,null,"BaZ",1<<25)
        {
            public void run()
            {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new MyScanner();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        n = ni();
        m = ni();
        c = new char[n][m];
        for(int i=0;i<n;++i) {
            c[i] = ne().toCharArray();
        }
        painted = new boolean[n][m];
        for(int i=0;i<n;++i) {
            for(int j=0;j<m;++j) {
                if(canPaint(i,j)) {
                    //pl("can paint "+i+","+j);
                    paint(i,j);
                }
            }
        }
        boolean ok = true;
        for(int i=0;i<n;++i) {
            for(int j=0;j<m;++j) {
                if(c[i][j]=='#' && !painted[i][j]) {
                    ok = false;
                }
            }
        }
        if(ok) {
            pl("YES");
        }
        else {
            pl("NO");
        }
        pw.flush();
        pw.close();
    }
    static boolean canPaint(int x, int y) {
        if(x-1>=0 && x+1<n && y-1>=0 && y+1<m) {
            for(int i=-1;i<=1;++i) {
                for(int j=-1;j<=1;++j) {
                    if(i==0 && j==0) {
                        continue;
                    }
                    if(c[x+i][y+j]=='.') {
                        return false;
                    }
                }
            }
            return true;
        }
        return false;
    }
    static void paint(int x, int y) {
        for(int i=-1;i<=1;++i) {
            for(int j=-1;j<=1;++j) {
                if(i==0 && j==0) {
                    continue;
                }
                painted[x+i][y+j] = true;
            }
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}

import java.util.Scanner;

public class B1059 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int R = in.nextInt();
        int C = in.nextInt();
        char[][] grid = new char[R][];
        for (int r=0; r<R; r++) {
            grid[r] = in.next().toCharArray();
        }
        int[][] pen = new int[][] {
            {0,0},
            {1,0},
            {2,0},
            {2,1},
            {2,2},
            {1,2},
            {0,2},
            {0,1}
        };
        for (int r=0; r<R-2; r++) {
            for (int c=0; c<C-2; c++) {
                boolean usePen = true;
                for (int[] pos : pen) {
                    if (grid[r+pos[0]][c+pos[1]] == '.') {
                        usePen = false;
                        break;
                    }
                }
                if (usePen) {
                    for (int[] pos : pen) {
                        grid[r+pos[0]][c+pos[1]] = 'X';
                    }
                }
            }
        }
        boolean filled = true;
        for (int r=0; r<R; r++) {
            for (int c=0; c<C; c++) {
                if (grid[r][c] == '#') {
                    filled = false;
                }
            }
        }
        System.out.println(filled ? "YES" : "NO");
    }

}

import java.io.*;
import java.util.*;

public class mymy
{

	public static void main(String[] args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		String[] s=br.readLine().split(" ");
		int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]);

		char[][] a=new char[n+2][m+2];
		int[][] flag=new int[n+2][m+2];

		for(int i=1;i<=n;i++)
		{
			String s1=br.readLine();
			for(int j=1;j<=m;j++)
			{
				a[i][j]=s1.charAt(j-1);
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(a[i-1][j-1]=='#'&&a[i-1][j]=='#'&&a[i-1][j+1]=='#'&&a[i][j-1]=='#'&&a[i][j+1]=='#'&&a[i+1][j-1]=='#'&&a[i+1][j]=='#'&&a[i+1][j+1]=='#')
				{
					flag[i-1][j-1]=1;flag[i-1][j]=1;flag[i-1][j+1]=1;flag[i][j-1]=1;flag[i][j+1]=1;flag[i+1][j-1]=1;flag[i+1][j]=1;flag[i+1][j+1]=1;
				}
			}
		}
		String ans="YES";
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if((a[i][j]=='#'&&flag[i][j]==0))
					ans="NO";
			}
		}

		System.out.println(ans);
	}
}

import java.io.*;
import java.util.*;

public class Main{
static int mod = (int)(Math.pow(10, 9) + 7);
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));
      int n = sc.nextInt();
      int m = sc.nextInt();
      int[][] nums = new int[n][m];
      for (int i = 0; i < n; i++){
          String s = sc.next();
          for (int j = 0; j < m; j++) nums[i][j] =s.charAt(j) == '#' ? 1:0;
      }
      for (int i = 2; i < n; i++){
          for (int j = 2; j < m; j++){
            if (nums[i][j] >= 1 &&
            nums[i][j-1] >= 1 &&
            nums[i][j-2] >= 1 &&
            nums[i-1][j] >= 1 &&
            nums[i-1][j-2] >= 1 &&
            nums[i-2][j-2] >= 1 &&
            nums[i-2][j-1] >= 1 &&
            nums[i-2][j] >= 1
            )   {
                nums[i][j] =2;
            nums[i][j-1] =2 ;
            nums[i][j-2] =2;
            nums[i-1][j] =2 ;
            nums[i-1][j-2] =2;
            nums[i-2][j-2] =2 ;
            nums[i-2][j-1] =2 ;
            nums[i-2][j] =2 ;
            }
          }
      }
      boolean works = true;
      for (int i = 0; i < n; i++){
          for (int j = 0; j < m; j++){
              if (nums[i][j] == 1) works = false;
          }
      }
      out.println(works ? "YES": "NO");

      out.close();
   }
static void mergeSort(int[] A){ // low to hi sort, single array only
      int n = A.length;
      if (n < 2) return;
      int[] l = new int[n/2];
      int[] r = new int[n - n/2];

      for (int i = 0; i < n/2; i++){
        l[i] = A[i];
      }

      for (int j = n/2; j < n; j++){
        r[j-n/2] = A[j];
      }

      mergeSort(l);
      mergeSort(r);
      merge(l, r, A);
    }

    static void merge(int[] l, int[] r, int[] a){
      int i = 0, j = 0, k = 0;
      while (i < l.length && j < r.length && k < a.length){
        if (l[i] < r[j]){
          a[k] = l[i];
          i++;
        }
        else{
          a[k] = r[j];
          j++;
        }
        k++;
      }
      while (i < l.length){
        a[k] = l[i];
        i++;
        k++;
      }

      while (j < r.length){
        a[k] = r[j];
        j++;
        k++;
      }
    }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
   //--------------------------------------------------------
}

import java.awt.*;
import java.lang.reflect.Array;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class GFG {

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static  class pair {
        int a,b;
        pair(int a,int b){
            this.a=a;this.b=b;
        }

    }

    public static void main(String[] args) {
        FastReader s = new FastReader();
        int n=s.nextInt();int m=s.nextInt();
        int arr[][] = new int[n][m];
        for(int i=0;i<n;i++){
            String str=s.next();
            for(int j=0;j<m;j++){
                if(str.charAt(j)=='.'){
                    arr[i][j]=0;
                }else {
                    arr[i][j]=1;
                }
            }
        }

        int vis[][] = new int[n][m];

        for(int i=1;i<n-1;i++){
            for(int j=1;j<m-1;j++){
                int x[] = {0,0,1,-1,1,-1,1,-1};
                int y[] = {1,-1,0,0,1,-1,-1,1};

                boolean flag=true;
                for(int in=0;in<8;in++){
                    int X=i+x[in];
                    int Y=j+y[in];
                    if(arr[X][Y]!=1){
                        flag=false;
                    }
                }
                if(flag){
                    for(int in=0;in<8;in++){
                        int X=i+x[in];
                        int Y=j+y[in];
                        vis[X][Y]=1;
                    }
                }
            }
        }

        for(int i=0;i<n;i++) {
            for (int j=0;j<m; j++) {
                if(vis[i][j]!=arr[i][j]){
                    System.out.println("NO");
                    return;
                }
            }
        }

        System.out.println("YES");
    }
}

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	static final boolean[][] PATTERN = { { true, true, true }, { true, false, true }, { true, true, true } };

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		char[][] grid = new char[n][m];
		for (int r = 0; r < n; r++) {
			String line = sc.next();
			for (int c = 0; c < m; c++) {
				grid[r][c] = line.charAt(c);
			}
		}
		System.out.println(solve(grid) ? "YES" : "NO");

		sc.close();
	}

	static boolean solve(char[][] grid) {
		int n = grid.length;
		int m = grid[0].length;

		char[][] filled = new char[n][m];
		for (int r = 0; r < filled.length; r++) {
			Arrays.fill(filled[r], '.');
		}

		for (int r = 0; r + PATTERN.length <= n; r++) {
			for (int c = 0; c + PATTERN[0].length <= m; c++) {
				if (canFill(grid, r, c)) {
					fill(filled, r, c);
				}
			}
		}

		return isEqual(filled, grid);
	}

	static boolean canFill(char[][] grid, int r, int c) {
		return IntStream.range(0, PATTERN.length).allMatch(
				i -> IntStream.range(0, PATTERN[0].length).allMatch(j -> !PATTERN[i][j] || grid[r + i][c + j] == '#'));
	}

	static void fill(char[][] filled, int r, int c) {
		IntStream.range(0, PATTERN.length)
				.forEach(i -> IntStream.range(0, PATTERN[0].length).filter(j -> PATTERN[i][j]).forEach(j -> {
					filled[r + i][c + j] = '#';
				}));
	}

	static boolean isEqual(char[][] filled, char[][] grid) {
		return IntStream.range(0, filled.length)
				.allMatch(r -> IntStream.range(0, filled[0].length).allMatch(c -> filled[r][c] == grid[r][c]));
	}
}

import java.io.File;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;

public class main {

	static Scanner input = new Scanner(System.in);

	public static void main(String[] args) {
		int n = input.nextInt();
		int m = input.nextInt();
		input.nextLine();
		char[][] a = new char[n][m];
		char [] [] drawGrid = new char [n] [m] ;
		int [] dx = { 0, -1, 1, -1, 1, 0, -1, 1 };
		int [] dy = { -1, -1, -1, 0, 0, 1, 1, 1 };
		for (int i = 0; i < n; i++) {
				String f = input.nextLine();
				a[i] = f.toCharArray();
				for (int j = 0 ; j < m ; j++) {
					drawGrid[i][j] = '.';
				}
		}

		boolean isOk = true;
		for (int i = 1; i < n - 1&&isOk; i++) {
			for (int j = 1; j < m - 1; j++) {
				int cnt = 0 ;
				for (int k = 0 ; k < 8 ; k++) {
					int x = i+dx[k]; int y = j +dy[k];
					if (a[x][y]=='#') cnt++;
				}
				if (cnt==8) {
					for (int k = 0 ; k < 8 ; k++) {
						int x = i+dx[k]; int y = j +dy[k];
						drawGrid[x][y] = '#';
					}
				}
			}

		}

		for (int i = 0 ; i < n&&isOk ; i++) {
			for (int j = 0; j < m ; j++) {
				if (a[i][j]!=drawGrid[i][j]) {
					isOk = false;
					break;
				}
			}
		}

		if (isOk) System.out.println("YES");
		else System.out.println("NO");

	}

}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        char[][] grid = new char[n][m];
        boolean[][] good = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            String string = in.readLine();
            for (int j = 0; j < m; j++) {
                grid[i][j] = string.charAt(j);
            }
        }
        for (int i = 1; i < n-1; i++) {
            for (int j = 1; j < m-1; j++) {
                boolean flag = true;
                for (int dx = -1; dx <= 1; dx++) {
                    for (int dy = -1; dy <= 1; dy++) {
                        if (dx == 0 && dy == 0) {
                            continue;
                        }
                        if (grid[i+dx][j+dy] == '.') {
                            flag = false;
                        }
                    }
                }
                if (flag) {
                    for (int dx = -1; dx <= 1; dx++) {
                        for (int dy = -1; dy <= 1; dy++) {
                            if (dx == 0 && dy == 0) {
                                continue;
                            }
                            if (grid[i+dx][j+dy] == '#') {
                                good[i+dx][j+dy] = true;
                            }
                        }
                    }
                }
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (grid[i][j] == '#' && !good[i][j]) {
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }

}
/*

 */

import java.util.Scanner;

/**
 *
 * @author Ahmed
 */
public class JavaApplication156 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int m = input.nextInt();
        char[][] grid = new char[n][m];
        for (int i = 0; i < n; i++) {
            grid[i] = input.next().toCharArray();
        }
        for (int i = 0; i < n-2; i++) {
            for (int j = 0; j < m-2; j++) {
                String box = grid[i][j]+""; box += ""+ (char)grid[i+1][j]; box += ""+(char)grid[i+2][j];box += ""+ (char)grid[i][j+1];box += "" + (char)grid[i+2][j+1];box += "" + (char)grid[i+2][j];box += ""+  (char)grid[i+2][j+1];box += "" + (char)grid[i+2][j+2];
                if (box.matches("[0#]+")){
                    grid[i][j] = '0';
                    grid[i][j+1] = '0';
                    grid[i][j+2] = '0';
                    grid[i+1][j+2] = '0';
                    grid[i+1][j] = '0';
                    grid[i+2][j] = '0';
                    grid[i+2][j+1] = '0';
                    grid[i+2][j+2] = '0';
                }
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (grid[i][j] == '#'){
                    System.out.println("NO");
                    System.exit(0);
                }
            }
        }
        System.out.println("YES");
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @author Andrei Chugunov
 */
public class Main {

    private static class Solution {
        static int R, C;
        static char[][] grid, ans;

        private void solve(FastScanner in, PrintWriter out) {
            R = in.nextInt(); C = in.nextInt();
            grid = new char[R][C];
            ans = new char[R][C];
            for (int i = 0; i < R; i++) {
                grid[i] = in.next().toCharArray();
                Arrays.fill(ans[i], '.');
            }
            for (int i = 0; i < R; i++) {
                for (int j = 0; j < C; j++) {
                    if (valid(i, j)) {
                        fill(i, j);
                    }
                }
            }
            for (int i = 0; i < R; i++) {
                for (int j = 0; j < C; j++) {
                    if (grid[i][j] != ans[i][j]) {
                        out.println("NO");
                        return;
                    }
                }
            }
            out.println("YES");
        }

        static boolean valid(int i, int j) {
            if (i + 3 > R || j + 3 > C) return false;
            for (int k = 0; k < 3; k++) {
                for (int f = 0; f < 3; f++) {
                    if (k == 1 && f == 1) continue;
                    if (grid[i + k][j + f] != '#')
                        return false;
                }
            }
            return true;
        }

        static void fill(int i, int j) {
            for (int k = 0; k < 3; k++) {
                for (int f = 0; f < 3; f++) {
                    if (k == 1 && f == 1) continue;
                    ans[i + k][j + f] = '#';
                }
            }
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solution solver = new Solution();
        solver.solve(in, out);
        out.flush();
        //out.close();
    }

    private static class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        FastScanner(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            st = null;
        }

        private String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }
    }
}

/*
Roses are red
Memes are neat
All my test cases time out
Lmao yeet
*/
import java.util.*;
import java.io.*;

   public class B
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int M = Integer.parseInt(st.nextToken());
         int[][] grid = new int[N][M];
         for(int i=0; i < N; i++)
         {
            String s = infile.readLine();
            int a = 0;
            for(char c: s.toCharArray())
            {
               if(c == '#')
                  grid[i][a]++;
               a++;
            }
         }
         //empty means adj cell is not pen spot
         int[] dx = {-1, 0, 1};
         int[] dy = {-1, 0, 1};
         int[][] tag = new int[N][M];
         for(int i=0; i < N; i++)
            for(int a=0; a < M; a++)
               if(grid[i][a] == 0)
               {
                  //bash neighbors
                  for(int x=0; x < 3; x++)
                     for(int y=0; y < 3; y++)
                     {
                        if(x == 1 && y == 1)
                           continue;
                        int ni = i+dx[x];
                        int na = a+dy[y];
                        if(ni < 0 || na < 0 || ni == N || na == M)
                           continue;
                        tag[ni][na] = 1;
                     }
               }
         for(int i=0; i < N; i++)
         {
            tag[i][0] = 1;
            tag[i][M-1] = 1;
         }
         for(int i=0; i < M; i++)
         {
            tag[0][i] = 1;
            tag[N-1][i] = 1;
         }
         //test possible pen spots
         for(int x=0; x < N; x++)
            for(int y=0; y < M; y++)
               if(grid[x][y] == 1)
               {
                  //bash neighbors
                  boolean bo = true;
                  for(int a=0; a < 3; a++)
                     for(int b=0; b < 3; b++)
                     {
                        if(a == 1 && b == 1)
                           continue;
                        int ni = x+dx[a];
                        int na = y+dy[b];
                        if(ni < 0 || na < 0 || ni == N || na == M)
                           continue;
                        bo = bo && tag[ni][na] == 1;
                     }
                  if(bo)
                  {
                     System.out.println("NO");
                     return;
                  }
               }
         System.out.println("YES");
      }
   }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {

    private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer tok = null;

    private static String nextToken() throws IOException {
        if (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(reader.readLine());
        }
        return tok.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public static long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        int n = nextInt();
        int m = nextInt();

        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = nextToken();
        }

        boolean[][] b = new boolean[n][m];
        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                if (s[i - 1].charAt(j - 1) == '#' && s[i - 1].charAt(j) == '#' &&
                        s[i - 1].charAt(j + 1) == '#' && s[i].charAt(j - 1) == '#' &&
                        s[i].charAt(j + 1) == '#' && s[i + 1].charAt(j - 1) == '#' &&
                        s[i + 1].charAt(j) == '#' && s[i + 1].charAt(j + 1) == '#') {
                    b[i - 1][j - 1] = true;
                    b[i - 1][j] = true;
                    b[i - 1][j + 1] = true;
                    b[i][j - 1] = true;
                    b[i][j + 1] = true;
                    b[i + 1][j - 1] = true;
                    b[i + 1][j] = true;
                    b[i + 1][j + 1] = true;
                }
            }
        }

        boolean result = true;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                result = result && (s[i].charAt(j) == '#') == b[i][j];
            }
        }

        if (result) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;

public class B {

    public static void main(String[] ar) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        sc.nextLine();

        boolean[][] filled = new boolean[n][m];

        for (int i = 0; i < n; i++) {
            char[] line = sc.nextLine().toCharArray();
            for (int j = 0; j < m; j++) {
                if (line[j] == '#') filled[i][j] = true;
            }
        }

        if (n < 3 || m < 3) {
            System.out.println("NO");
            return;
        }
        if (n == 3 && m == 3 && filled[1][1]) {
            System.out.println("NO");
            return;
        }

        System.out.println("YES");

    }

}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class B {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), m = ni();
		char ar[][] = new char[n][m];
		for(int i=0;i<n;i++){
			ar[i] = ns().toCharArray();
		}
		char br[][] = new char[n][m];
		String ans = "YES";
		for(int i=1;i<n-1;i++){
			for(int j=1;j<m-1;j++){
				fun(i, j, ar, br);
			}
		}
		out.println(check(ar, br, n, m) ? "YES" : "NO");
	}
	static boolean check(char ar[][], char br[][], int n, int m){
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(ar[i][j]=='#' && br[i][j]!='#'){
					return false;
				}
			}
		}
		return true;
	}
	static void fun(int x, int y, char ar[][], char br[][]){
		for(int i=-1;i<=1;i++){
			for(int j=-1;j<=1;j++){
				if(i==0 && j==0) continue;
				// System.out.println("i="+i+" j="+j);
				int nx = x+i, ny = y+j;
				// if(ar[nx][ny]=='#')
				br[nx][ny] = '#';
			}
		}
	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new B().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class B {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), m = ni();
		char ar[][] = new char[n][m];
		for(int i=0;i<n;i++){
			ar[i] = ns().toCharArray();
		}
		char br[][] = new char[n][m];
		String ans = "YES";
		for(int i=1;i<n-1;i++){
			for(int j=1;j<m-1;j++){
				fun(i, j, ar, br);
			}
		}
		out.println(check(ar, br, n, m) ? "YES" : "NO");
	}
	static boolean check(char ar[][], char br[][], int n, int m){
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(ar[i][j]=='#' && br[i][j]!='#'){
					return false;
				}
			}
		}
		return true;
	}
	static void fun(int x, int y, char ar[][], char br[][]){
		for(int i=-1;i<=1;i++){
			for(int j=-1;j<=1;j++){
				if(i==0 && j==0) continue;
				int nx = x+i, ny = y+j;
				if(ar[nx][ny]=='#') br[nx][ny] = '#';
			}
		}
	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new B().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		sc.nextLine();
		char[][] grid = new char[n][m];
		int[][] checked = new int[n][m];
		for(int i=0; i<n; i++){
			String line = sc.nextLine();
			for(int j=0; j<m; j++){
				grid[i][j] = line.charAt(j);
				checked[i][j] = 0;
			}
		}

		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){

				if(grid[i][j]=='#'){
					int valid = 0;
					for(int k=-1; k<=1; k++){
						for(int l=-1; l<=1; l++){
							if(k!=0 || l!=0){
								int pos1 = i+k;
								int pos2 = j+l;
								if(pos1<0 || pos1>=n || pos2<0 || pos2>=m){
									continue;
								}
								int done = 0;
								for(int k1=-1; k1<=1; k1++){
									for(int l1=-1; l1<=1; l1++){
										if(pos1+k1<0 || pos1+k1>=n || pos2+l1<0 || pos2+l1>=m){
											done = 1;
											break;
										}
										if(grid[pos1+k1][pos2+l1]!='#' && k1!=0 && l1!=0){
											done=1;
											break;
										}
									}
									if(done==1){
										break;
									}
								}
								if(done==0){
									valid=1;
									break;
								}
						}
					}
					if(valid==1){
						break;
					}
				}
				if(valid==0){
					System.out.print("NO");
					System.exit(0);
				}
			}
		}
		}

		System.out.print("YES");

	}
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static Integer[][] getSubMatrix(Integer[][] matrix, int i, int j) {
		Integer[][] subMatrix = new Integer[3][3];
		subMatrix[0][0] = matrix[i - 1][j - 1];
		subMatrix[0][1] = matrix[i - 1][j];
		subMatrix[0][2] = matrix[i - 1][j + 1];
		subMatrix[1][0] = matrix[i][j - 1];
		subMatrix[1][1] = matrix[i][j];
		subMatrix[1][2] = matrix[i][j + 1];
		subMatrix[2][0] = matrix[i + 1][j - 1];
		subMatrix[2][1] = matrix[i + 1][j];
		subMatrix[2][2] = matrix[i + 1][j + 1];
		return subMatrix;
	}

	public static Integer[][] print(Integer[][] m) {
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				if (i == 1 && j == 1)
					m[i][j] = Math.max(m[i][j], 0);
				else
					m[i][j] = 1;
			}
		}
		return m;
	}

	public static boolean isStable(Integer[][] m1, Integer[][] m2) {
		boolean stable = true;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				if (m1[i][j] != m2[i][j]) {
					if(m1[i][j] == 0 && m2[i][j] == 1)
						return false;
				}
			}
		}
		return stable;
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		Integer n = scanner.nextInt();
		Integer m = scanner.nextInt();
		Integer[][] originalMatrix = new Integer[n][m];
		scanner.nextLine();

		Integer[][] testMatrix = new Integer[n][m];

		for (int i = 0; i < n; i++) {
			String line = scanner.nextLine();
			for (int j = 0; j < line.length(); j++) {
				originalMatrix[i][j] = (line.charAt(j) == '#') ? 1 : 0;
				testMatrix[i][j] = 0;
			}
		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {
				Integer[][] subOriginalMatrix = Main.getSubMatrix(originalMatrix, i, j);
				Integer[][] subTestMatrix = Main.getSubMatrix(testMatrix, i, j);
				subTestMatrix = Main.print(subTestMatrix);
				if (Main.isStable(subOriginalMatrix, subTestMatrix)) {
					testMatrix[i - 1][j - 1] = subTestMatrix[0][0];
					testMatrix[i - 1][j] = subTestMatrix[0][1];
					testMatrix[i - 1][j + 1] = subTestMatrix[0][2];
					testMatrix[i][j - 1] = subTestMatrix[1][0];
					testMatrix[i][j] = subTestMatrix[1][1];
					testMatrix[i][j + 1] = subTestMatrix[1][2];
					testMatrix[i + 1][j - 1] = subTestMatrix[2][0];
					testMatrix[i + 1][j] = subTestMatrix[2][1];
					testMatrix[i + 1][j + 1] = subTestMatrix[2][2];
				}
			}
		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {
				if(originalMatrix[i][j] != testMatrix[i][j]) {
					System.out.println("NO");
					return;
				}
			}
		}
		System.out.println("YES");
		scanner.close();
	}
}

/*
[ ( ^ _ ^ ) ]
*/
import java.io.*;
import java.util.*;

public class test {
    int INF = (int)1e9;
    long MOD = 1000000007;

    void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();
        char[][] s = new char[n][];
        char ee = '.', ff = '#';
        for(int i=0; i<n; i++) {
            s[i] = in.next().toCharArray();
        }
        int[][] a = new int[n][m];
        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) if(s[i][j]=='#') {
                if(i<=n-3 && j<=m-3) {
                    //show(i, j);
                    boolean f = false;
                    if(s[i][j+1]==ee) f = true;
                    else if(s[i][j+2]==ee) f = true;
                    else if(s[i+1][j]==ee || s[i+1][j+2]==ee) f = true;
                    else if(s[i+2][j]==ee || s[i+2][j+1]==ee || s[i+2][j+2]==ee) f = true;
                    if(!f) {
                        a[i][j] = a[i][j+1] = a[i][j+2] = 1;
                        a[i+1][j] = a[i+1][j+2] = 1;
                        a[i+2][j] = a[i+2][j+1] = s[i+2][j+2] = 1;
                    }
                }
            }
        }
        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) {
                if(s[i][j]=='#' && a[i][j]==0) {
                    out.println("NO");
                    return;
                }
                if(s[i][j]=='.' && a[i][j]==1) {
                    out.println("NO");
                    return;
                }
            }
        }
        out.println("YES");
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-->0) {
            new test().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }

    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    class Pair implements Comparable<Pair> {
        long f, s;

        Pair(long f, long s) {
            this.f=f;
            this.s=s;
        }

        public int hashCode() {
            int hf = (int) (f ^ (f >>> 32));
            int hs = (int) (s ^ (s >>> 32));
            return 31 * hf + hs;
        }

        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return s == other.s && f == other.f;
        }

        public int compareTo(Pair p) {
            return Long.compare(this.s, p.s);
        }

        public String toString() {
            return "(" + f + ", " + s + ")";
        }
    }
}

import java.util.*;
import java.io.*;

public class Solution {

	static class FastScanner implements Closeable {
	    BufferedReader in;
	    StringTokenizer st;
	    FastScanner() throws IOException {
	        in = new BufferedReader(new InputStreamReader(System.in));
	    }
	    String next() throws IOException {
	        while (st == null || !st.hasMoreTokens()) {
	            String line = in.readLine();
	            if (line == null) {
	            	return null;
	            }
	            st = new StringTokenizer(line);
	        }
	        return st.nextToken();
	    }
	    int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    public void close() throws IOException {
	        in.close();
	        st = null;
	    }
	}

	static boolean blackBox(String n){
		for(int i = 0; i < n.length(); i++){
			char x = n.charAt(i);
			if(x != '7' && x != '4')
				return false;
		}

		return true;
	}

	public static void main(String[] args) throws IOException{

		try(FastScanner sc = new FastScanner();
			PrintWriter out = new PrintWriter(System.out)){

			int n = sc.nextInt();
			int m = sc.nextInt();
			char[][] arr = new char[n][m];

			for(int i = 0; i < n; i++)
				arr[i] = sc.next().toCharArray();

			for(int i = 1; i < n-1; i++){
				for(int j = 1; j < m-1; j++){
					arr[i-1][j-1] = '1';
					arr[i-1][j] = '1';
					arr[i-1][j+1] = '1';
					arr[i][j-1] = '1';
					arr[i][j+1] = '1';
					arr[i+1][j-1] = '1';
					arr[i+1][j] = '1';
					arr[i+1][j+1] = '1';
				}
			}

			for(int i = 0; i < n; i++){
				for(int j = 0; j < m; j++){
					if(arr[i][j] == '#'){
						System.out.println("NO");
						return;
					}
				}
			}

			System.out.println("YES");
		}

	}
}

import java.util.*;
import java.io.*;

/**
 *
 * @author shivam attree
 */

public class DarkAndCruel
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        char[][] ch=new char[n][m];
        char[][] map=new char[n][m];
        for(char[] row : map)
        {
            Arrays.fill(row, '.');
        }
        int empty=0;
        for(int i=0;i<n;i++)
        {
            String str=sc.next();
            for(int j=0;j<str.length();j++)
            {
                ch[i][j]=str.charAt(j);
                if(ch[i][j]=='.')
                    empty++;
            }
        }
//        System.out.println("here");
        if(empty==0)
        {
            if(n==3 && m==3)
                System.out.println("NO");
            else
                System.out.println("YES");
        }
        else
        {
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    if(i-1>=0 && j-1>=0 && i+1<n && j+1<m)
                    {
                        map[i-1][j]=ch[i-1][j];
                        map[i][j-1]=ch[i][j-1];
                        map[i+1][j]=ch[i+1][j];
                        map[i][j+1]=ch[i][j+1];
                        map[i-1][j-1]=ch[i-1][j-1];
                        map[i-1][j+1]=ch[i-1][j+1];
                        map[i+1][j+1]=ch[i+1][j+1];
                        map[i+1][j-1]=ch[i+1][j-1];
                    }
                }
            }
            int f=0;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    if(map[i][j]!=ch[i][j])
                    {
                        f=1;
                        break;
                    }
                }
                if(f==1)
                    break;
            }
            if(f==1)
                System.out.println("NO");
            else
                System.out.println("YES");
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader br;
    static StringTokenizer st;

    public static String nextToken() {
        try {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return st.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt(nextToken());
    }

    static long nextLong() {
        return Long.parseLong(nextToken());
    }

    static Double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    static char nextChar() throws IOException {
        return (char) br.read();
    }

    static String nextString() throws IOException {
        return br.readLine();
    }

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        //Scanner sc = new Scanner(System.in);
        int n = nextInt();
        int m = nextInt();
        int[][] pole = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (nextChar() == '#') {
                    pole[i][j] = 1;
                }
            }
            nextChar();
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (pole[i][j] == 1) {
                    if (i + 2 < n && j + 2 < m && pole[i][j + 1] != 0 && pole[i][j + 2] != 0 && pole[i + 1][j] != 0 && pole[i + 1][j + 2] != 0
                            && pole[i + 2][j] != 0 && pole[i][j + 1] != 0 && pole[i][j + 2] != 0) {
                        pole[i][j] = 2;
                        pole[i][j + 1] = 2;
                        pole[i][j + 2] = 2;
                        pole[i + 1][j] = 2;
                        pole[i + 1][j + 2] = 2;
                        pole[i + 2][j] = 2;
                        pole[i + 2][j + 1] = 2;
                        pole[i + 2][j + 2] = 2;
                    } else {
                        System.out.print("NO");
                        System.exit(0);
                    }
                }else if(pole[i][j] == 2){
                    if (i + 2 < n && j + 2 < m && pole[i][j + 1] != 0 && pole[i][j + 2] != 0 && pole[i + 1][j] != 0 && pole[i + 1][j + 2] != 0
                            && pole[i + 2][j] != 0 && pole[i][j + 1] != 0 && pole[i][j + 2] != 0) {
                        pole[i][j] = 2;
                        pole[i][j + 1] = 2;
                        pole[i][j + 2] = 2;
                        pole[i + 1][j] = 2;
                        pole[i + 1][j + 2] = 2;
                        pole[i + 2][j] = 2;
                        pole[i + 2][j + 1] = 2;
                        pole[i + 2][j + 2] = 2;
                    }
                }
            }
        }
        System.out.println("YES");
    }
}

import java.util.Scanner;
import java.util.stream.IntStream;

public class Solution {

	public static int[] toIntArray(String s) {
		String[] nums = s.split("\\s");
		return IntStream.range(0, nums.length)
			.map(index -> Integer.parseInt(nums[index]))
			.toArray();
	}

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int[] mn = toIntArray(scanner.nextLine());

		int n = mn[0], m = mn[1];

		char[][] signArea = new char[n][m];

		for (int i = 0; i < n; i++) {

			signArea[i] = scanner.nextLine()
					.trim()
					.toCharArray();

		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {

				placePen(signArea, i, j);

			}
		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {

				if(signArea[i][j] == '#') {
					System.out.println("NO");
					return;
				}

			}
		}
		System.out.println("YES");
	}

	private static void placePen(char[][] signArea, int i, int j) {

		if (isWithInk(i + 1,j + 1, signArea) &&
				isWithInk(i + 1,j, signArea)&&
				isWithInk(i + 1,j - 1, signArea) &&
				isWithInk(signArea, i, j + 1)  && isWithInk(signArea,i,j - 1)  && isWithInk(signArea, i - 1, j + 1)&&
				isWithInk(signArea, i - 1,j)&& isWithInk(i - 1,j - 1,signArea )) {
			signArea[i + 1][j + 1] = 'v';
			signArea[i + 1][j] = 'v';
			signArea[i + 1][j - 1] = 'v';
			signArea[i][j + 1] = 'v';
			signArea[i][j - 1] = 'v';
			signArea[i - 1][j + 1] = 'v';
			signArea[i - 1][j] = 'v';
			signArea[i - 1][j - 1] = 'v';
		}

	}

	public static boolean isWithInk(int i, int j, char[][] signArea) {
		return signArea[i][j] == 'v' || signArea[i][j] == '#';
	}

	public static boolean isWithInk(char[][] signArea, int i, int j) {
		return signArea[i][j] == 'v' || signArea[i][j] == '#';
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Solution {
    private static int[] dx = {
            -1, -1, -1,
            0, 0,
            1, 1, 1};
    private static int[] dy = {
            -1, 0, 1,
            -1, 1,
            -1, 0, 1};

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

        int r = in.nextInt();
        int c = in.nextInt();
        boolean[][] m = new boolean[r + 1][c + 1];
        for (int i = 0; i < r; i++) {
            String s = in.next();
            //System.out.println(m[i]);
            for (int j = 0; j < s.length(); j++) {
                if (s.charAt(j) == '#') {
                    m[i][j] = true;
                }
            }
        }

        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                if (canPress(i, j, r, c)) {

                    // make press
                    for (int k = 0; k < 8; k++) {
                        int xi = i + dx[k];
                        int yi = j + dy[k];
                        m[xi][yi] = false;
                    }

                }
            }
        }
        boolean isLeftAny = false;
        for (int i = 0; i < r && !isLeftAny; i++) {
            for (int j = 0; j < c && !isLeftAny; j++) {
                if (m[i][j]) {
                    isLeftAny = true;
                    break;
                }
            }
        }
        if(isLeftAny){
            System.out.println("NO");
        }else{
            System.out.println("YES");
        }
    }

    private static boolean canPress(int x, int y, int r, int c) {
        for (int i = 0; i < 8; i++) {
            int xi = x + dx[i];
            int yi = y + dy[i];
            if (xi < 0 || yi < 0) {
                return false;
            }
            if (xi >= r || yi >= c) {
                return false;
            }
        }
        return true;
    }
}

import java.util.*;
import java.io.*;
public class forgery {
	static boolean check(int i,int j,int[][] mat,int n,int m) {
		if(i+3>n || j+3>n)
			return false;
		for(int k=i;k<i+3;k++) {
			for(int l=j;l<j+3;l++) {
				if(k==i+1 && l==j+1 && mat[k][l]==0)
					continue;
				if(mat[k][l]==0 || (k==i+1 && l==j+1 && mat[k][l]==1))
					return false;
			}
		}
		return true;
	}
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] inp=br.readLine().split(" ");
		int n=Integer.parseInt(inp[0]);
		int m=Integer.parseInt(inp[1]);
		int[][] mat=new int[n][m];
		for(int i=0;i<n;i++) {
			String val=br.readLine();
			for(int j=0;j<m;j++) {
				mat[i][j]=0;
				if(val.charAt(j)=='#')
					mat[i][j]=1;
			}
		}
		boolean ans=true;
		int i=0,j=0;
		while(i<n && j<n){
		//	System.out.println(i+" "+j);
			if(mat[i][j]==0) {
				j++;
				if(j==m) {
					i++;j=0;
				}
				continue;
			}
			if(mat[i][j]==1) {
				ans=check(i,j,mat,n,m);
				j+=3;
				if(j==m) {
					i+=3;j=0;
				}
			}
			if(ans==false)
				break;
			}

		if(ans==true)
			System.out.println("Yes");
		else
			System.out.println("No");

	}

}

import java.util.*;

public class forge {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int m = in.nextInt();
    in.nextLine();
    int [][] grid = new int[n][m];
    int [][] newgrid = new int[n][m];
    int[][] newnewgrid = new int[n][m];
    for (int i = 0; i < n; i++) {
      String x = in.nextLine();
      for (int j = 0; j < m; j++) {
        grid[i][j] = (x.charAt(j) == '.') ? 0 : 1;
      }
    }

    for (int i = 1; i < n - 1; i++) {
      for (int j = 1; j < m - 1; j++) {
        int nmarks = 0;
        for (int ii = -1; ii <= 1; ii++) {
          for (int jj = -1; jj <= 1; jj++) {
            if (ii == 0 && jj == 0) {
              continue;
            }

            if (grid[i+ii][j+jj] == 1) {
              nmarks += 1;
            }

          }
        }

        if (nmarks == 8) {
          newgrid[i][j] = 1;
        }
      }
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (newgrid[i][j] == 1) {
          for (int ii = -1; ii <= 1; ii++) {
            for (int jj = -1; jj <= 1; jj++) {
              if (ii == 0 && jj == 0) {
                continue;
              }
              newnewgrid[i+ii][j+jj] = 1;
            }
          }
        }
      }
    }

    for (int i = 1; i < n - 1; i++) {
      for (int j = 1; j < m - 1; j++) {
        if (newnewgrid[i][j] != grid[i][j]) {
          System.out.println("NO");
          System.exit(0);
        }
      }
    }
    System.out.println("YES");
  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author noone
 */
public class Main {
        public static void main(String[] args) {
                InputStream inputStream = System.in;
                OutputStream outputStream = System.out;
                InputReader in = new InputReader(inputStream);
                PrintWriter out = new PrintWriter(outputStream);
                TaskB solver = new TaskB();
                solver.solve(1, in, out);
                out.close();
        }

        static class TaskB {
                boolean[][] forbidden;

                public void solve(int testNumber, InputReader in, PrintWriter out) {
                        int n = in.i();
                        int m = in.i();
                        char[][] array = in.nm(n, m);
                        forbidden = new boolean[n][m];

                        for (int i = 0; i < n; i++) {
                                Arrays.fill(forbidden[i], true);
                        }

                        fillOuterWithFalse(n, m);

                        for (int i = 1; i < n - 1; i++) {
                                for (int j = 1; j < m - 1; j++) {
                                        if (array[i][j] == '.') {
                                                for (int k = 0; k < 8; k++) {
                                                        forbidden[i + IntegerUtil.dx[k]][j + IntegerUtil.dy[k]] = false;
                                                }
                                        }
                                }
                        }
                        boolean ans = true;
                        for (int i = 1; i < n - 1; i++) {
                                for (int j = 1; j < m - 1; j++) {
                                        boolean seen = false;
                                        if (array[i][j] == '#') {
                                                for (int k = 0; k < 8; k++) {
                                                        int dx = IntegerUtil.dx[k];
                                                        int dy = IntegerUtil.dy[k];
                                                        if (forbidden[i + dx][j + dy]) {
                                                                seen = true;
                                                                break;
                                                        }
                                                }
                                                if (!seen) {
                                                        ans = false;
                                                }
                                        }
                                }
                        }
                        if (!ans) {
                                out.println("NO");
                                return;
                        }
                        out.println("YES");
                }

                private void fillOuterWithFalse(int n, int m) {
                        for (int i = 0; i < n; i++) {
                                if (i == 0 || i == n - 1) {
                                        for (int j = 0; j < m; j++) {
                                                forbidden[i][j] = false;
                                        }
                                }
                                forbidden[i][0] = false;
                                forbidden[i][m - 1] = false;
                        }
                }

        }

        static class IntegerUtil {
                public static int[] dx = {1, 1, 0, -1, -1, -1, 0, 1};
                public static int[] dy = {0, 1, 1, 1, 0, -1, -1, -1};

        }

        static class InputReader {
                InputStream is;
                private byte[] inbuf = new byte[1024];
                public int lenbuf = 0;
                public int ptrbuf = 0;

                public InputReader(InputStream is) {
                        this.is = is;
                }

                private int readByte() {
                        if (lenbuf == -1) throw new InputMismatchException();
                        if (ptrbuf >= lenbuf) {
                                ptrbuf = 0;
                                try {
                                        lenbuf = is.read(inbuf);
                                } catch (IOException e) {
                                        throw new InputMismatchException();
                                }
                                if (lenbuf <= 0) return -1;
                        }
                        return inbuf[ptrbuf++];
                }

                private boolean isSpaceChar(int c) {
                        return !(c >= 33 && c <= 126);
                }

                private int skip() {
                        int b;
                        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
                        return b;
                }

                public char[] sa(int n) {
                        char[] buf = new char[n];
                        int b = skip(), p = 0;
                        while (p < n && !(isSpaceChar(b))) {
                                buf[p++] = (char) b;
                                b = readByte();
                        }
                        return n == p ? buf : Arrays.copyOf(buf, p);
                }

                public char[][] nm(int n, int m) {
                        char[][] map = new char[n][];
                        for (int i = 0; i < n; i++) map[i] = sa(m);
                        return map;
                }

                public int i() {
                        int num = 0, b;
                        boolean minus = false;
                        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
                        if (b == '-') {
                                minus = true;
                                b = readByte();
                        }

                        while (true) {
                                if (b >= '0' && b <= '9') {
                                        num = num * 10 + (b - '0');
                                } else {
                                        return minus ? -num : num;
                                }
                                b = readByte();
                        }
                }

        }
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.awt.*;
import java.awt.geom.*;
import java.math.*;
import java.text.*;
import java.math.BigInteger.*;
import java.util.Arrays;

public class   cf514p2
{
  BufferedReader in;
  StringTokenizer as;
  boolean nums[][],nums2[][];
  ArrayList < Integer > [] ar;

  public static void main (String[] args)
  {
    new cf514p2  ();
  }

  public void solve(int a, int b)
  {
    try
    {
      for(int x = -1;x<=1;x++)
      {
        for(int y = -1;y<=1;y++)
        {
          if( ((x != 0) || (y!=0)) && !nums[a+x][b+y])
          {
            return;
          }
        }
      }
      for(int x = -1;x<=1;x++)
      {
        for(int y = -1;y<=1;y++)
        {
          if( ((x != 0) || (y!=0)))
          {
            nums2[a+x][b+y] = true;
          }
        }
      }
    }
    catch(Exception e )
    {
      return;
    }
  }

  public cf514p2  ()
  {
    try
    {

      in = new BufferedReader (new InputStreamReader (System.in));
      ArrayList < Integer > [] ar;
      int a = nextInt();
      int b = nextInt();
      nums = new boolean [a][b];
      nums2 = new boolean [a][b];
      for(int x = 0;x<a;x++)
      {
        String c = nextLine();
        for(int x1 = 0;x1<b;x1++)
        {
          if(c.charAt(x1) == '#')
          {
            nums[x][x1] = true;
          }
          else if (c.charAt(x) == '.')
          {
            nums[x][x1] = false;
          }
        }
      }
      for(int x = 0;x<a;x++)
      {
        for(int x1 = 0;x1<b;x1++)
        {
          solve(x,x1);
        }
      }
      for(int x = 1;x<a-1;x++)
      {
        for(int x1 = 1;x1<b-1;x1++)
        {
          if(nums2[x][x1] != nums[x][x1])
          {
            System.out.println("NO");
            System.exit(0);
          }
        }
      }
      System.out.println("YES");
    }

    catch(Exception e)
    {
      System.out.println("NO");
    }
  }

  String next () throws IOException
  {
    while (as == null || !as.hasMoreTokens ())
    {
      as = new StringTokenizer (in.readLine ().trim ());
    }

    return as.nextToken ();
  }

  long nextLong () throws IOException
  {
    return Long.parseLong (next ());
  }

  int nextInt () throws IOException
  {
    return Integer.parseInt (next ());
  }

  double nextDouble () throws IOException
  {
    return Double.parseDouble (next ());
  }

  String nextLine () throws IOException
  {
    return in.readLine ().trim ();
  }
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class Cf182 implements Runnable
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}
	public static void main(String args[]) throws Exception
	{
		new Thread(null, new Cf182(),"Main",1<<27).start();
	}

	public static long gcd(long a, long b)
	{
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}
	//  array sorting by colm
public static void sortbyColumn(int arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<int[]>() {

          @Override
          public int compare(final int[] entry1,
                             final int[] entry2) {

            if (entry1[col] > entry2[col])
                return 1;
            else
                return -1;
          }
        });
    }

	// gcd

	public static long findGCD(long arr[], int n)
	{
		long result = arr[0];
		for (int i = 1; i < n; i++)
			result = gcd(arr[i], result);
		return result;
	}
	// fibonaci
	static int fib(int n)
    {
        int a = 0, b = 1, c;
        if (n == 0)
            return a;
        for (int i = 2; i <= n; i++)
        {
            c = a + b;
            a = b;
            b = c;
        }
        return b;
    }

// sort a string
    public static String sortString(String inputString)
    {

        char tempArray[] = inputString.toCharArray();

        Arrays.sort(tempArray);

        return new String(tempArray);
    }
    // pair function

    // list.add(new Pair<>(sc.nextInt(), i + 1));
    //     Collections.sort(list, (a, b) -> Integer.compare(b.first, a.first));
    private static class Pair<F, S> {

        private F first;

        private S second;

        public Pair() {}

        public Pair(F first, S second) {
            this.first = first;
            this.second = second;
        }
    }

	// SortedArrayList<Integer> test = new SortedArrayList<Integer>();
    // test.insert(5);
            public static class SortedArrayList<T> extends ArrayList<T> {

            @SuppressWarnings("unchecked")
            public void insert(T value) {
                add(value);
                Comparable<T> cmp = (Comparable<T>) value;
                for (int i = size()-1; i > 0 && cmp.compareTo(get(i-1)) < 0; i--)
                    Collections.swap(this, i, i-1);
            }
        }

	public void run()
	{
		InputReader sc = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		int n = sc.nextInt();
		int m = sc.nextInt();

		String s[] = new String[n];

		for(int i=0;i<n;i++)
		    s[i] = sc.next();

		int flag = 0;

		for(int i = 0;i<n-2;i++)
		{
		    for(int j=0;j<s[i].length()-2;j++)
		    {
		        if(s[i].charAt(j) =='#' && s[i].charAt(j+1) == '#' && s[i].charAt(j+2) == '#' &&
		        s[i+1].charAt(j) =='#' && s[i+1].charAt(j+1) == '.' && s[i+1].charAt(j+2)=='#' &&
		        s[i+2].charAt(j) =='#' && s[i+2].charAt(j+1) == '#' && s[i+2].charAt(j+2)=='#')
		        {
		            flag = 1;
		            break;
		        }
		    }
		    if(flag==1)
		        break;
		}

		if(flag==0)
		    w.println("NO");
		else
		    w.println("YES");

        w.flush();
	    w.close();
	}
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class templ implements Runnable {
    class pair
    {
        int f,s;
        pair(int fi,int se)
        {
            f=fi;
            s=se;
        }
    }
    static int binarySearch(int arr[], int l, int r, int x)
    {
        if (r >= l)
        {
            int mid = l + (r - l)/2;
            if (arr[mid] == x)
                return mid;
            if (arr[mid] > x)
                return binarySearch(arr, l, mid-1, x);
            return binarySearch(arr, mid+1, r, x);
        }
        return -1;
    }
    void merge1(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i]<=R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort1(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort1(arr, l, m);
            sort1(arr , m+1, r);
            merge1(arr, l, m, r);
        }
    }
    void merge3(int arr[],int arr1[],int arr2[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        //long L3[]=new long[n1];
        //long R3[]=new long[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            //L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            //R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                //arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                //arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            //arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            //arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort3(int arr[],int arr1[],int arr2[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort3(arr,arr1,arr2, l, m);
            sort3(arr ,arr1,arr2, m+1, r);
            merge3(arr,arr1,arr2,l, m, r);
        }
    }
    void merge2(int arr[],int arr1[],int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            j++;
            k++;
        }
    }
    void sort2(int arr[],int arr1[],int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort2(arr,arr1, l, m);
            sort2(arr ,arr1, m+1, r);
            merge2(arr,arr1,l, m, r);
        }
    }
    void merge4(int arr[],int arr1[],int arr2[],int arr3[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        int L3[]=new int[n1];
        int R3[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort4(int arr[],int arr1[],int arr2[],int arr3[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort4(arr,arr1,arr2,arr3, l, m);
            sort4(arr ,arr1,arr2,arr3, m+1, r);
            merge4(arr,arr1,arr2,arr3,l, m, r);
        }
    }
    public int justsmall(long a[],int l,int r,long x)
    {
        int p=-1;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<=x)
            {
                p=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        return p;
    }
    public int justlarge(long a[],int l,int r,long x)
    {
        int p=0;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<x)
            {
                l=mid+1;
            }
            else
            {
                p=mid;
                r = mid - 1;
            }
        }
        return p;
    }
    long gcd(long x,long y)
    {
        if(x%y==0)
            return y;
        else
            return(gcd(y,x%y));
    }
    int fact(int n)
    {
        int ans=1;
        for(int i=1;i<=n;i++)
            ans*=i;
        return ans;
    }
    long bintoint(String s)
    {
        long a=0;
        int l=s.length();
        int k=0;
        for(int i=l-1;i>=0;i--)
        {
            char c=s.charAt(i);
            if(c=='1')
            {
                a=a+(long)Math.pow(2,k);
            }
            k++;
        }
        return a;
    }
    String inttobin(long x)
    {
        String s="";
        while(x!=0)
        {
            long k=x%2;
            if(k==1)
                s="1"+s;
            else
                s="0"+s;
            x=x/2;
        }
        return s;
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new templ(),"templ",1<<26).start();
    }
    public void run() {
        try {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int n=in.ni();
            int m=in.ni();
            int a[][]=new int[n+2][m+2];
            int b[][]=new int[n+2][m+2];
            for(int i=1;i<=n;i++)
            {
                String s=in.nextLine();
                for(int j=0;j<m;j++)
                {
                    char c=s.charAt(j);
                    if(c=='#')
                        a[i][j+1]=1;
                    else
                        a[i][j+1]=0;
                }
            }
            for(int i=0;i<=n;i++)
            {
                for(int j=0;j<=n;j++)
                {
                    b[i][j]=a[i][j];
                }
            }
            int k=0;
            for(int i=1;i<=n-1;i++)
            {
                for(int j=1;j<=m-1;j++)
                {
                    if(a[i][j]==0)
                        continue;
                    if(a[i-1][j-1]==1&&a[i-1][j]==1&&a[i-1][j+1]==1&&a[i][j-1]==1&&a[i][j+1]==1&&a[i+1][j-1]==1&&a[i+1][j]==1&&a[i+1][j+1]==1)
                    {
                        b[i-1][j-1]=1;
                        b[i-1][j]=1;
                        b[i-1][j+1]=1;
                        b[i][j-1]=1;
                        b[i][j]=1;
                        b[i][j+1]=1;
                        b[i+1][j-1]=1;
                        b[i+1][j]=1;
                        b[i+1][j+1]=1;
                    }
                }
            }
            for(int i=1;i<n;i++)
            {
                for(int j=1;j<n;j++)
                {
                    if(a[i][j]==1&&b[i][j]!=1)
                    {
                        k=1;
                        break;
                    }
                }
            }
            if(k==0)
                out.println("YES");
            else
                out.println("NO");
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class templ implements Runnable {
    class pair
    {
        int f,s;
        pair(int fi,int se)
        {
            f=fi;
            s=se;
        }
    }
    static int binarySearch(int arr[], int l, int r, int x)
    {
        if (r >= l)
        {
            int mid = l + (r - l)/2;
            if (arr[mid] == x)
                return mid;
            if (arr[mid] > x)
                return binarySearch(arr, l, mid-1, x);
            return binarySearch(arr, mid+1, r, x);
        }
        return -1;
    }
    void merge1(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i]<=R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort1(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort1(arr, l, m);
            sort1(arr , m+1, r);
            merge1(arr, l, m, r);
        }
    }
    void merge3(int arr[],int arr1[],int arr2[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        //long L3[]=new long[n1];
        //long R3[]=new long[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            //L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            //R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                //arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                //arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            //arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            //arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort3(int arr[],int arr1[],int arr2[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort3(arr,arr1,arr2, l, m);
            sort3(arr ,arr1,arr2, m+1, r);
            merge3(arr,arr1,arr2,l, m, r);
        }
    }
    void merge2(int arr[],int arr1[],int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            j++;
            k++;
        }
    }
    void sort2(int arr[],int arr1[],int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort2(arr,arr1, l, m);
            sort2(arr ,arr1, m+1, r);
            merge2(arr,arr1,l, m, r);
        }
    }
    void merge4(int arr[],int arr1[],int arr2[],int arr3[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        int L3[]=new int[n1];
        int R3[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort4(int arr[],int arr1[],int arr2[],int arr3[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort4(arr,arr1,arr2,arr3, l, m);
            sort4(arr ,arr1,arr2,arr3, m+1, r);
            merge4(arr,arr1,arr2,arr3,l, m, r);
        }
    }
    public int justsmall(long a[],int l,int r,long x)
    {
        int p=-1;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<=x)
            {
                p=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        return p;
    }
    public int justlarge(long a[],int l,int r,long x)
    {
        int p=0;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<x)
            {
                l=mid+1;
            }
            else
            {
                p=mid;
                r = mid - 1;
            }
        }
        return p;
    }
    long gcd(long x,long y)
    {
        if(x%y==0)
            return y;
        else
            return(gcd(y,x%y));
    }
    int fact(int n)
    {
        int ans=1;
        for(int i=1;i<=n;i++)
            ans*=i;
        return ans;
    }
    long bintoint(String s)
    {
        long a=0;
        int l=s.length();
        int k=0;
        for(int i=l-1;i>=0;i--)
        {
            char c=s.charAt(i);
            if(c=='1')
            {
                a=a+(long)Math.pow(2,k);
            }
            k++;
        }
        return a;
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new templ(),"templ",1<<26).start();
    }
    public void run() {
        try {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int n=in.ni();
            int m=in.ni();
            int a[][]=new int[n+2][m+2];
            int b[][]=new int[n+2][m+2];
            for(int i=1;i<=n;i++)
            {
                String s=in.nextLine();
                for(int j=0;j<m;j++)
                {
                    char c=s.charAt(j);
                    if(c=='#')
                        a[i][j+1]=1;
                    else
                        a[i][j+1]=0;
                }
            }
            for(int i=0;i<=n;i++)
            {
                for(int j=0;j<=n;j++)
                {
                    b[i][j]=a[i][j];
                }
            }
            int k=0;
            for(int i=1;i<=n-1;i++)
            {
                for(int j=1;j<=m-1;j++)
                {
                    if(a[i][j]==0)
                        continue;
                    if(a[i-1][j-1]==1&&a[i-1][j]==1&&a[i-1][j+1]==1&&a[i][j-1]==1&&a[i][j+1]==1&&a[i+1][j-1]==1&&a[i+1][j]==1&&a[i+1][j+1]==1)
                    {
                        b[i-1][j-1]=1;
                        b[i-1][j]=1;
                        b[i-1][j+1]=1;
                        b[i][j-1]=1;
                        b[i][j]=1;
                        b[i][j+1]=1;
                        b[i+1][j-1]=1;
                        b[i+1][j]=1;
                        b[i+1][j+1]=1;
                    }
                }
            }
            for(int i=1;i<n;i++)
            {
                for(int j=1;j<n;j++)
                {
                    if(a[i][j]==1&&b[i][j]!=1)
                    {
                        k=1;
                        break;
                    }
                }
            }
            if(k==0)
                out.println("YES");
            else
                out.println("NO");
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class templ implements Runnable {
    class pair
    {
        int f,s;
        pair(int fi,int se)
        {
            f=fi;
            s=se;
        }
    }
    static int binarySearch(int arr[], int l, int r, int x)
    {
        if (r >= l)
        {
            int mid = l + (r - l)/2;
            if (arr[mid] == x)
                return mid;
            if (arr[mid] > x)
                return binarySearch(arr, l, mid-1, x);
            return binarySearch(arr, mid+1, r, x);
        }
        return -1;
    }
    void merge1(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i]<=R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort1(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort1(arr, l, m);
            sort1(arr , m+1, r);
            merge1(arr, l, m, r);
        }
    }
    void merge3(int arr[],int arr1[],int arr2[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        //long L3[]=new long[n1];
        //long R3[]=new long[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            //L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            //R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                //arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                //arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            //arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            //arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort3(int arr[],int arr1[],int arr2[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort3(arr,arr1,arr2, l, m);
            sort3(arr ,arr1,arr2, m+1, r);
            merge3(arr,arr1,arr2,l, m, r);
        }
    }
    void merge2(int arr[],int arr1[],int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            j++;
            k++;
        }
    }
    void sort2(int arr[],int arr1[],int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort2(arr,arr1, l, m);
            sort2(arr ,arr1, m+1, r);
            merge2(arr,arr1,l, m, r);
        }
    }
    void merge4(int arr[],int arr1[],int arr2[],int arr3[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        int L3[]=new int[n1];
        int R3[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort4(int arr[],int arr1[],int arr2[],int arr3[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort4(arr,arr1,arr2,arr3, l, m);
            sort4(arr ,arr1,arr2,arr3, m+1, r);
            merge4(arr,arr1,arr2,arr3,l, m, r);
        }
    }
    public int justsmall(long a[],int l,int r,long x)
    {
        int p=-1;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<=x)
            {
                p=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        return p;
    }
    public int justlarge(long a[],int l,int r,long x)
    {
        int p=0;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<x)
            {
                l=mid+1;
            }
            else
            {
                p=mid;
                r = mid - 1;
            }
        }
        return p;
    }
    long gcd(long x,long y)
    {
        if(x%y==0)
            return y;
        else
            return(gcd(y,x%y));
    }
    int fact(int n)
    {
        int ans=1;
        for(int i=1;i<=n;i++)
            ans*=i;
        return ans;
    }
    long bintoint(String s)
    {
        long a=0;
        int l=s.length();
        int k=0;
        for(int i=l-1;i>=0;i--)
        {
            char c=s.charAt(i);
            if(c=='1')
            {
                a=a+(long)Math.pow(2,k);
            }
            k++;
        }
        return a;
    }
    String inttobin(long x)
    {
        String s="";
        while(x!=0)
        {
            long k=x%2;
            if(k==1)
                s="1"+s;
            else
                s="0"+s;
            x=x/2;
        }
        return s;
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new templ(),"templ",1<<26).start();
    }
    public void run() {
        try {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int n=in.ni();
            int m=in.ni();
            int a[][]=new int[n+2][m+2];
            int b[][]=new int[n+2][m+2];
            for(int i=1;i<=n;i++)
            {
                String s=in.nextLine();
                for(int j=0;j<m;j++)
                {
                    char c=s.charAt(j);
                    if(c=='#')
                        a[i][j+1]=1;
                    else
                        a[i][j+1]=0;
                }
            }
            for(int i=0;i<=n;i++)
            {
                for(int j=0;j<=n;j++)
                {
                    b[i][j]=a[i][j];
                }
            }
            int k=0;
            for(int i=1;i<=n-1;i++)
            {
                for(int j=1;j<=m-1;j++)
                {
                    if(a[i][j]==1)
                        continue;
                    if(a[i-1][j-1]==1&&a[i-1][j]==1&&a[i-1][j+1]==1&&a[i][j-1]==1&&a[i][j+1]==1&&a[i+1][j-1]==1&&a[i+1][j]==1&&a[i+1][j+1]==1)
                    {
                        b[i-1][j-1]=1;
                        b[i-1][j]=1;
                        b[i-1][j+1]=1;
                        b[i][j-1]=1;
                        b[i][j]=1;
                        b[i][j+1]=1;
                        b[i+1][j-1]=1;
                        b[i+1][j]=1;
                        b[i+1][j+1]=1;
                    }
                }
            }
            for(int i=1;i<n;i++)
            {
                for(int j=1;j<n;j++)
                {
                    if(a[i][j]==1&&b[i][j]!=1)
                    {
                        k=1;
                        break;
                    }
                }
            }
            if(k==0)
                out.println("YES");
            else
                out.println("NO");
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }
}

import java.io.*;
import java.util.*;
import java.lang.*;

public class Rextester{
    public static boolean check(char[][] array,int x,int y){
        try{
            if((array[x-1][y-1]=='#'||array[x-1][y-1]=='.')&&(array[x-1][y]=='#'||array[x-1][y]=='.')&&(array[x-1][y+1]=='.'||array[x-1][y+1]=='#')&&
               (array[x][y-1]=='.'||array[x][y-1]=='#')&&(array[x][y+1]=='#'||array[x][y+1]=='.')&&(array[x+1][y-1]=='.'||array[x+1][y-1]=='#')&&
               (array[x+1][y]=='.'||array[x+1][y]=='#')&&(array[x+1][y+1]=='.'||array[x+1][y+1]=='#')){
                return true;
            }
            else{
                return false;
            }
        }catch(Exception e){
            return false;
        }
    }
    public static void set(char[][] array,int x,int y){
        array[x-1][y-1]='.';
        array[x-1][y]='.';
        array[x-1][y+1]='.';
        array[x][y-1]='.';
        array[x][y+1]='.';
        array[x+1][y-1]='.';
        array[x+1][y]='.';
        array[x+1][y+1]='.';
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int r = new Integer(st.nextToken());
        int c = new Integer(st.nextToken());
        char[][] array = new char[r][c];
        for(int i=0;i<r;i++){
            array[i]=br.readLine().toCharArray();
        }
        br.close();
        for(int i=0;i<r;i++){
            for(int j=0;j<c;j++){
                if(array[i][j]=='#'){
                    if(check(array,i+1,j+1)){
                        set(array,i+1,j+1);
                    }
                    else if(check(array,i+1,j)){
                        set(array,i+1,j);
                    }
                    else if(check(array,i+1,j-1)){
                        set(array,i+1,j-1);
                    }
                    else if(check(array,i,j+1)){
                        set(array,i,j+1);
                    }
                    else if(check(array,i,j-1)){
                        set(array,i,j-1);
                    }
                    else if(check(array,i-1,j+1)){
                        set(array,i-1,j+1);
                    }
                    else if(check(array,i-1,j)){
                        set(array,i-1,j);
                    }
                    else if(check(array,i-1,j-1)){
                        set(array,i-1,j-1);
                    }
                }
            }
        }
        for(int i=0;i<r;i++){
            for(int j=0;j<c;j++){
                if(array[i][j]=='#'){
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }
}

import java.util.*;
import java.util.regex.Pattern;
public class Forgery {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
in.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
String[] g = new String[n];
char[][] grid = new char[n][m];
for (int i=0; i<n; i++) {
    g[i] = in.next();
} // end for i

for (int i=0; i<n; i++) {
    for (int j=0; j<m; j++) {
        grid[i][j] = g[i].charAt(j);
    }
} // end for i

for (int i=1; i< n-1; i++) {
    for (int j=1; j<m-1; j++) {
        if ((grid[i-1][j-1] == '#' || grid[i-1][j-1] == 'x') &&
            (grid[i-1][j] == '#' || grid[i-1][j] == 'x') &&
            (grid[i-1][j+1] == '#' || grid[i-1][j+1] == 'x') &&
            (grid[i][j-1] == '#' || grid[i-1][j-1] == 'x') &&
            (grid[i][j+1] == '#' || grid[i-1][j+1] == 'x') &&
            (grid[i+1][j-1] == '#' || grid[i+1][j-1] == 'x') &&
            (grid[i+1][j] == '#' || grid[i+1][j] == 'x') &&
            (grid[i+1][j+1] == '#' || grid[i+1][j+1] == 'x') ) {
                grid[i-1][j-1] = 'x';
                grid[i-1][j] = 'x';
                grid[i-1][j+1] = 'x';
                grid[i][j-1] = 'x';
                grid[i][j+1] = 'x';
                grid[i+1][j-1] = 'x';
                grid[i+1][j] = 'x';
                grid[i+1][j+1] = 'x';
            } // end if

    }
} // end for i

boolean forge = true;
for (int i=0; i<n; i++) {
    for (int j=0; j<m; j++) {
        if (grid[i][j] == '#') forge = false;
    }
} // end for i

System.out.println(forge?"YES": "NO"); //
} // end main
}

import java.io.*;
import java.lang.reflect.Field;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        new Main();
    }

    Main() throws IOException {
        solve();
    }

    void solve() throws IOException {
        int n = Reader.nextInt();
        int m = Reader.nextInt();
        boolean[][] inked = new boolean[n][m];
        for(int i = 0; i < n; i++){
            String x = Reader.next();
            for(int j = 0; j < m; j++){
                if(x.charAt(j) == '#'){inked[i][j] = true;}
                else{inked[i][j] = false;}
            }
        }
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if(inked[i][j]){
                    if( i-1 > 0){
                        if(j-1 > 0){ unink(i-1, j-1, inked);}
                        if(j+1 < m-1){unink(i-1, j+1, inked);}
                    }
                    if(i+1 < n-1){
                        if(j-1 > 0){ unink(i+1, j-1, inked);}
                        if(j+1 < m-1){unink(i+1, j+1, inked);}
                    }
                }
            }
        }
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if(inked[i][j]){System.out.println("NO"); return;}
            }
        }
        System.out.println("YES");
    }

    void unink(int i, int j, boolean[][] grid){
        grid[i-1][j-1] = grid[i-1][j] = grid[i-1][j+1] = grid[i][j+1] = grid[i][j-1] = grid[i+1][j-1] = grid[i+1][j] = grid[i+1][j+1] = false;
    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");

    }

    static String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {

                tokenizer = new StringTokenizer(reader.readLine());

            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    static String next() throws IOException {

        while ( ! tokenizer.hasMoreTokens() ) {

            tokenizer = new StringTokenizer(

                    reader.readLine() );

        }
        return tokenizer.nextToken();

    }

    static int nextInt() throws IOException {

        return Integer.parseInt( next() );

    }

    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }

    static long nextLong() {

        return Long.parseLong(nextToken());
    }
}

import java.awt.color.*;
import java.util.*;
import java.awt.Point;
import java.math.*;
import java.io.*;
@SuppressWarnings("unused")
public class implementation {int[] b;	String g="";int c=0;int M=1000000000+7;ArrayList<Integer> list=new ArrayList<Integer>();String s;int[] size;int[] id;
int[]ab;int[] data;int mod=100000;LinkedList<Integer> queue=new LinkedList<Integer>();int dis=0;int max=0;ArrayList<Integer>[] arr;
	public static void main(String[] args)  {
                new implementation().solve();
                                  }
	long[] fact;long[] inv;
            public void solve(){
             int n=sc.nextInt();int m=sc.nextInt();int c=0;
             char[][] arr=new char[n][m];
             for(int i=0;i<n;i++) {
            	 String s=sc.next();
            	 for(int j=0;j<m;j++) {
            		arr[i][j]=s.charAt(j);
            	 }
             }

             for(int i=1;i<n-1;i++) {
            	 for(int j=1;j<m-1;j++) {
            		 arr[i+1][j]='.'; arr[i+1][j+1]='.'; arr[i+1][j-1]='.';
            		 arr[i][j-1]='.'; arr[i-1][j-1]='.';
            		 arr[i][j+1]='.'; arr[i-1][j+1]='.'; arr[i-1][j]='.';
            	 }
             }

             for(int i=0;i<n;i++) {
            	 for(int j=0;j<m;j++) {
            		 if(arr[i][j]=='#')
            		 {
            			 c=1;break;
            		 }
            	 }
             }
             if(c==1)
            	 System.out.println("NO");
             else
            	 System.out.println("YES");
            }

            static final int MAXN = 15000000+1;

            // stores smallest prime factor for every number
            static int spf[] = new int[MAXN];

            // Calculating SPF (Smallest Prime Factor) for every
            // number till MAXN.
            // Time Complexity : O(nloglogn)

            static void sieve()
            {
                spf[1] = 1;
                for (int i=2; i<MAXN; i++)

                    // marking smallest prime factor for every
                    // number to be itself.
                    spf[i] = i;

                // separately marking spf for every even
                // number as 2
                for (int i=4; i<MAXN; i+=2)
                    spf[i] = 2;

                for (int i=3; i*i<MAXN; i++)
                {
                    // checking if i is prime
                    if (spf[i] == i)
                    {
                        // marking SPF for all numbers divisible by i
                        for (int j=i*i; j<MAXN; j+=i)

                            // marking spf[j] if it is not
                            // previously marked
                            if (spf[j]==j)
                                spf[j] = i;
                    }
                }
            }

            static int gcd(int a, int b)
            {
              if (b == 0)
                return a;
              return gcd(b, a % b);
            }

            public class Node{
       	     int x;int color;int y;
       	       Node par;
       	        public Node(int a,int b) {
       	          	x=a;color=b;

       	             }
                         }
                     class sortbyweight implements Comparator<Integer>{

					@Override
					public int compare(Integer a, Integer b) {

       					if(a<b)
                			return -1;
                		else
                			return 1;
					}}

       				 FastReader sc=new FastReader();
       				 static class FastReader
       				     {
       				         BufferedReader br;
       				         StringTokenizer st;

       				         public FastReader()
       				         {
       				             br = new BufferedReader(new
       				                      InputStreamReader(System.in));
       				         }

       				         String next()
       				         {
       				             while (st == null || !st.hasMoreElements())
       				             {
       				                 try
       				                 {
       				                     st = new StringTokenizer(br.readLine());
       				                 }
       				                 catch (IOException  e)
       				                 {
       				                     e.printStackTrace();
       				                 }
       				             }
       				             return st.nextToken();
       				         }

       				         int nextInt()
       				         {
       				             return Integer.parseInt(next());
       				         }

       				         long nextLong()
       				         {
       				             return Long.parseLong(next());
       				         }

       				         double nextDouble()
       				         {
       				             return Double.parseDouble(next());
       				         }

       				         String nextLine()
       				         {
       				             String str = "";
       				             try
       				             {
       				                 str = br.readLine();
       				             }
       				             catch (IOException e)
       				             {
       				                 e.printStackTrace();
       				             }
       				             return str;
       				         }
       				     }}

import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Vector;

public class Main {

    public static void main(String[] args) {
	    Scanner scanner =  new Scanner(System.in);
	    PrintWriter writer = new PrintWriter(System.out);
	    int n, m;
	    n = scanner.nextInt();
	    m = scanner.nextInt();
	    scanner.nextLine();
	    ArrayList<StringBuilder> chart = new ArrayList<>();
        for (int i = 0; i < n; ++i) {
            String line = scanner.nextLine();
            chart.add(new StringBuilder(line));
        }
        for (int i = 0; i < n - 2; ++i) {
            for (int j = 0; j < m - 2; ++j) {
                int sharps_count = 0;
                for (int y = 0; y < 3; ++y) {
                    for (int x = 0; x < 3; ++x) {
                        char c = chart.get(i + y).charAt(j + x);
                        if (c == '#' || c == '@')
                            sharps_count++;
                    }
                }
                boolean f1 = sharps_count == 9;
                boolean f2 = sharps_count == 8 && chart.get(i + 1).charAt(j + 1) == '.';
                if (f1 || f2) {
                    for (int x = 0; x < 3; ++x) {
                        for (int y = 0; y < 3; ++y) {
                            if (x == 1 && y == 1)
                                continue;
                            chart.get(i + y).setCharAt(j + x, '@');
                        }
                    }
                }
            }
        }
        boolean answer = true;
        for (int i = 0; i < n; ++i){
            if(chart.get(i).indexOf("#") < 0)
                answer = false;
        }
        System.out.println(answer ? "YES" : "NO");
    }
}

/* Author: Ronak Agarwal, reader part not written by me*/
import java.io.* ; import java.util.* ;
import static java.lang.Math.min ; import static java.lang.Math.max ;
import static java.lang.Math.abs ; import static java.lang.Math.log ;
import static java.lang.Math.pow ; import static java.lang.Math.sqrt ;
/* Thread is created here to increase the stack size of the java code so that recursive dfs can be performed */
public class Codeshefcode{
	public static void main(String[] args) throws IOException{
		new Thread(null,new Runnable(){	public void run(){ exec_Code() ;} },"Solver",1l<<27).start() ;
	}
	static void exec_Code(){
		try{
			Solver Machine = new Solver() ;
			Machine.Solve() ; Machine.Finish() ;}
		catch(Exception e){ e.printStackTrace() ; print_and_exit() ;}
		catch(Error e){ e.printStackTrace() ; print_and_exit() ; }
	}
	static void print_and_exit(){ System.out.flush() ; System.exit(-1) ;}
}
/* Implementation of the Reader class */
class Reader {
	private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar,numChars;
	public Reader() { this(System.in); }
	public Reader(InputStream is) { mIs = is;}
	public int read() {
		if (numChars == -1) throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}
			if (numChars <= 0) return -1;
		}
		return buf[curChar++];
	}
	public String nextLine(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString() ;
	}
	public String s(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		}while (!isSpaceChar(c));
		return res.toString();
	}
	public long l(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		long res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read();
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public int i(){
		int c = read() ;
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		int res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read() ;
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public void readL(long arr[],int l,int r){
		for(int i=l ; i<=r ; i++) arr[i] = l();
	}
	public void readI(int arr[],int l,int r){
		for(int i=l ; i<=r ; i++) arr[i] = i();
	}
	public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
	public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
}
/* All the useful functions,constants,renamings are here*/
class Template{
	/* Constants Section */
	final int INT_MIN = Integer.MIN_VALUE ; final int INT_MAX = Integer.MAX_VALUE ;
	final long LONG_MIN = Long.MIN_VALUE ; final long LONG_MAX = Long.MAX_VALUE ;
	static long MOD = 1000000007 ;
	static Reader ip = new Reader() ;
	static PrintWriter op = new PrintWriter(System.out) ;
	/* Methods for writing */
	static void p(Object o){ op.print(o) ; }
	static void pln(Object o){ op.println(o) ;}
	static void Finish(){ op.flush(); op.close(); }
	/* Implementation of operations modulo MOD */
	static long inv(long a){ return powM(a,MOD-2) ; }
	static long m(long a,long b){ return (a*b)%MOD ; }
	static long d(long a,long b){ return (a*inv(b))%MOD ; }
	static long powM(long x,long n){
		if(n<0) return powM(inv(x),-n) ;
		long y=1 ;
		for( ; n!=0 ; x=(x*x)%MOD , n/=2) if((n&1)==1) y = (y*x)%MOD ;
		return y ;
	}
	/* Renaming of some generic utility classes */
	final static class mylist extends ArrayList<Integer>{}
	final static class myset extends TreeSet<pair>{}
	final static class mystack extends Stack<Integer>{}
	final static class mymap extends TreeMap<Long,Integer>{}
}
/* Implementation of the pair class, useful for every other problem */
class pair implements Comparable<pair>{
	int x ; int y ;
	pair(int _x,int _y){ x=_x ; y=_y ;}
	public int compareTo(pair p){
		return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ;
	}
}
/* Main code starts here */
class Solver extends Template{
	int n,m;
	boolean check(int i,int j){
		return (i>=1 && i<=n && j>=1 && j<=m);
	}
	public void Solve() throws IOException{
		n = ip.i(); m = ip.i();
		int mat[][] = new int[n+1][m+1];
		for(int i=1 ; i<=n ; i++){
			char c[] = ip.s().toCharArray();
			for(int j=1 ; j<=m ; j++) mat[i][j] = (c[j-1]=='#' ? 1 : 0);
		}
		int nA[][] = new int[n+1][m+1];
		int nmat[][] = new int[n+1][m+1];
		for(int i=1 ; i<=n ; i++)
			for(int j=1 ; j<=m ; j++){
				if(i<=1 || j<=1 || i>=n || j>=m){ nA[i][j]=1; continue;}
				if(mat[i][j]==0){
					for(int di=-1 ; di<=1 ; di++)
						for(int dj=-1 ; dj<=1 ; dj++){
							int ii = i+di; int jj = j+dj;
							if(ii==i && jj==j) continue;
							if(check(ii,jj)) nA[ii][jj]=1;
						}
				}

			}
		for(int i=1 ; i<=n ; i++)
			for(int j=1 ; j<=m ; j++) if(nA[i][j]==0){
				for(int di=-1 ; di<=1 ; di++)
					for(int dj=-1 ; dj<=1 ; dj++){
						int ii = i+di; int jj = j+dj;
						if((ii==i) && (jj==j)) continue;
						if(check(ii,jj)) nmat[ii][jj]=1;
					}
			}
		for(int i=1 ; i<=n ; i++) for(int j=1 ; j<=m ; j++) if(nmat[i][j]!=mat[i][j]){
			pln("NO");
			return;
		}
		pln("YES");
	}
}

import java.io.*;
import java.util.*;
public class ku {

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		char [][] p=new char[n][m];
		char [][] s=new char[n][m];
		for(int i=0;i<n;i++) {
			String h=sc.nextLine();
			for(int j=0;j<m;j++) {
				p[i][j]=h.charAt(j);
			} Arrays.fill(s[i], '.');
		}
		int []x= {0,-1,-1,-1,0,1,1,1};
		int []y= {-1,-1,0,1,1,1,0,-1};
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				if(i>0 && j>0 && i<n-1 && j<m-1) {
				      	for(int o=0;o<8;o++) {
				      		int X=x[o]+i; int Y=y[o]+j;
				      	if(p[X][Y]=='#')
				      		s[X][Y]='#';
				      	else {
				      		for(int u=0;u<8;u++) {
					      		int I=x[o]+i; int J=y[o]+j; s[I][J]='.';
				      		}
				      	}
				      	}
				}
			}
		}
		boolean f=true;
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				if(p[i][j]!=s[i][j] )
					f=false;
			}
		}
	//	for(int i=0;i<n;i++)
		//	System.out.println(Arrays.toString(s[i]));
		if(f)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

import java.io.*;
import java.util.*;
public class ku {

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt(); boolean f=false;
		char [][] p=new char[n][m];
		char [][] s=new char[n][m];
		for(int i=0;i<n;i++) {
			String h=sc.nextLine();
			for(int j=0;j<m;j++) {
				p[i][j]=h.charAt(j);
			} Arrays.fill(s[i], '.');
		}
		int []x= {0,-1,-1,-1,0,1,1,1};
		int []y= {-1,-1,0,1,1,1,0,-1};
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				if(i>0 && j>0 && i<n-1 && j<m-1) { f=true;
				      	for(int o=0;o<8;o++) {
				      		int X=x[o]+i; int Y=y[o]+j;
				      	if(p[X][Y]=='#')
				      		s[X][Y]='#';
				      	else {
				      		for(int u=0;u<8;u++) {
					      		int I=x[o]+i; int J=y[o]+j; s[I][J]='.';
				      		}
				      	}
				      	}
				}
			}
		}

		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				if(p[i][j]!=s[i][j] )
					f=false;
			}
		}
	//	for(int i=0;i<n;i++)
		//	System.out.println(Arrays.toString(s[i]));
		if(f)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

import java.io.*;
import java.util.*;
public class ku {

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		char [][] p=new char[n][m];
		char [][] s=new char[n][m];
		for(int i=0;i<n;i++) {
			String h=sc.nextLine();
			for(int j=0;j<m;j++) {
				p[i][j]=h.charAt(j);
			}
		}
		int []x= {0,-1,-1,-1,0,1,1,1};
		int []y= {-1,-1,0,1,1,1,0,-1};
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				if(i>0 && j>0 && i<n-1 && j<m-1) {
				      	for(int o=0;o<8;o++) {
				      		int X=x[o]+i; int Y=y[o]+j;
				      		s[X][Y]='#';
				      	}
				}
			}
		}
		boolean f=true;
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				if(p[i][j]!=s[i][j] && p[i][j]=='#')
					f=false;
			}
		}
		if(f)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

import java.util.Scanner;

public class forgery
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int arr[][]=new int[n][m];
        sc.nextLine();
        int flag=0;
        for(int i=0;i<n;i++)
        {
            String a=sc.nextLine();
            for(int j=0;j<a.length();j++)
            {
                if(a.charAt(j)=='.')
                    arr[i][j]=0;
                if(a.charAt(j)=='#')
                    arr[i][j]=1;
            }
        }
        for(int i=1;i<n-1;i++)
        {
            for(int j=1;j<m-1;j++)
            {
                arr[i-1][j-1]=(arr[i-1][j-1]==1)?2:0;
                arr[i-1][j]=(arr[i-1][j]==1)?2:0;
                arr[i-1][j+1]=(arr[i-1][j+1]==1)?2:0;
                arr[i][j-1]=(arr[i][j-1]==1)?2:0;
                arr[i][j+1]=(arr[i][j+1]==1)?2:0;
                arr[i+1][j-1]=(arr[i+1][j-1]==1)?2:0;
                arr[i+1][j]=(arr[i+1][j]==1)?2:0;
                arr[i+1][j+1]=(arr[i+1][j+1]==1)?2:0;
            }
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                if(arr[i][j]==1)
                {
                    flag=1;
                    break;
                }
            }
        }
        if(flag==1)
            System.out.print("NO");
        else
            System.out.print("YES");
        sc.close();
    }
}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Forgery implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    public void solve() {
        int n = in.ni(), m = in.ni();
        char[][] grid = new char[n][m];
        for (int i = 0; i < n; i++) {
            grid[i] = in.next().toCharArray();
            for (int j = 0; j < m; j++) {

            }
        }
        boolean[][] filled = new boolean[n][m];
        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                filled[i - 1][j - 1] = filled[i - 1][j] = filled[i - 1][j + 1] = true;
                filled[i][j - 1] = filled[i][j + 1] = true;
                filled[i + 1][j - 1] = filled[i + 1][j] = filled[i + 1][j + 1] = true;
            }
        }
        boolean ok = true;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (grid[i][j] == '#') {
                    ok &= filled[i][j];
                }
            }
        }
        out.println(ok ? "YES" : "NO");
    }

    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public long nl() {
            return Long.parseLong(next());
        }

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) throws IOException {
        try (Forgery instance = new Forgery()) {
            instance.solve();
        }
    }
}

import java.io.*;
import java.util.*;

public class mymy
{

	public static void main(String[] args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		String[] s=br.readLine().split(" ");
		int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]);

		char[][] a=new char[n+2][m+2];
		int[][] flag=new int[n+2][m+2];

		for(int i=1;i<=n;i++)
		{
			String s1=br.readLine();
			for(int j=1;j<=m;j++)
			{
				a[i][j]=s1.charAt(j-1);
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if((i+2)<=n && (j+2)<=m)
				{
					flag[i][j]=1;flag[i][j+1]=1;flag[i][j+2]=1;flag[i+1][j]=1;flag[i+1][j+2]=1;flag[i+2][j]=1;flag[i+2][j+1]=1;flag[i+2][j+2]=1;
				}
			}
		}
		String ans="YES";
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(a[i][j]=='#'&&flag[i][j]==0)
					ans="NO";
			}
		}

		System.out.println(ans);

	}
}

import java.util.Scanner;

/**
 *
 * @author Ahmed
 */
public class JavaApplication156 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int m = input.nextInt();
        char[][] grid = new char[n][m];
        for (int i = 0; i < n; i++) {
            grid[i] = input.next().toCharArray();
        }
        if (n == 3 && m == 3 && grid[1][1] == '#')System.out.println("NO");
        else System.out.println("YES");
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Andrei Chugunov
 */
public class Main {

    private static class Solution {
        private void solve(FastScanner in, PrintWriter out) {
            //2 - forbidden
            //1 - filled
            //0 - empty
            int n = in.nextInt();
            int m = in.nextInt();
            int[][] grid = new int[n][m];

            for (int i = 0; i < n; i++) {
                String row = in.next();
                for (int j = 0; j < m; j++) {
                    if (i == 0 || i == n - 1 || j == 0 || j == m - 1) {
                        grid[i][j] = 2;
                        continue;
                    }
                    char cur = row.charAt(j);
                    if (cur == '#') {
                        grid[i][j] = 1;
                    }
                }
            }

            for (int i = 1; i < n-1; i++) {
                for (int j = 1; j < m-1; j++) {
                    if (grid[i][j] == 2) {
                        continue;
                    }
                    if (grid[i][j] == 0) {
                        grid[i-1][j] = 2;
                        grid[i+1][j] = 2;
                        grid[i][j-1] = 2;
                        grid[i][j+1] = 2;
                        grid[i-1][j-1] = 2;
                        grid[i-1][j+1] = 2;
                        grid[i+1][j-1] = 2;
                        grid[i+1][j+1] = 2;
                    }

                }
            }
            int cnt = 0;
            for (int i = 1; i < n-1; i++) {
                for (int j = 1; j < m-1; j++) {
                    if (grid[i][j] == 1) {
                        cnt++;
                        if (grid[i-1][j] == 2
                            && grid[i+1][j] == 2
                            && grid[i][j-1] == 2
                            && grid[i][j+1] == 2
                            && grid[i-1][j-1] == 2
                            && grid[i-1][j+1] == 2
                            && grid[i+1][j-1] == 2
                            && grid[i+1][j+1] == 2) {

                            out.println("NO");
                            return;
                        }
                    }
                }
            }
            if (cnt > 0) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

        private void print(PrintWriter out, int n, int m, int[][] grid) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (grid[i][j] == 1) {
                        out.print('#');
                    }
                    if (grid[i][j] == 0) {
                        out.print('.');
                    }
                    if (grid[i][j] == 2) {
                        out.print('F');
                    }
                }
                out.println();
            }
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solution solver = new Solution();
        solver.solve(in, out);
        out.flush();
        //out.close();
    }

    private static class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        FastScanner(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            st = null;
        }

        private String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Andrei Chugunov
 */
public class Main {

    private static class Solution {
        private void solve(FastScanner in, PrintWriter out) {
            //2 - forbidden
            //1 - filled
            //0 - empty
            int n = in.nextInt();
            int m = in.nextInt();
            int[][] grid = new int[n][m];

            for (int i = 0; i < n; i++) {
                String row = in.next();
                for (int j = 0; j < m; j++) {
                    if (i == 0 || i == n - 1 || j == 0 || j == m - 1) {
                        grid[i][j] = 2;
                        continue;
                    }
                    char cur = row.charAt(j);
                    if (cur == '#') {
                        grid[i][j] = 1;
                    }
                }
            }

            for (int i = 1; i < n-1; i++) {
                for (int j = 1; j < m-1; j++) {
                    if (grid[i][j] == 2) {
                        continue;
                    }
                    if (grid[i][j] == 0) {
                        grid[i-1][j] = 2;
                        grid[i+1][j] = 2;
                        grid[i][j-1] = 2;
                        grid[i][j+1] = 2;
                        grid[i-1][j-1] = 2;
                        grid[i-1][j+1] = 2;
                        grid[i+1][j-1] = 2;
                        grid[i+1][j+1] = 2;
                    }

                }
            }

            for (int i = 1; i < n-1; i++) {
                for (int j = 1; j < m-1; j++) {
                    if (grid[i][j] == 1) {
                        if (grid[i-1][j] == 2
                            && grid[i+1][j] == 2
                            && grid[i][j-1] == 2
                            && grid[i][j+1] == 2
                            && grid[i-1][j-1] == 2
                            && grid[i-1][j+1] == 2
                            && grid[i+1][j-1] == 2
                            && grid[i+1][j+1] == 2) {

                            out.println("NO");
                            return;
                        }
                    }
                }
            }

            out.println("YES");
        }

        private void print(PrintWriter out, int n, int m, int[][] grid) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (grid[i][j] == 1) {
                        out.print('#');
                    }
                    if (grid[i][j] == 0) {
                        out.print('.');
                    }
                    if (grid[i][j] == 2) {
                        out.print('F');
                    }
                }
                out.println();
            }
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solution solver = new Solution();
        solver.solve(in, out);
        out.flush();
        //out.close();
    }

    private static class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        FastScanner(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            st = null;
        }

        private String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }
    }
}

import java.io.*;
import java.util.StringTokenizer;

public class DeathNote {
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int a[][] = new int[n + 1][m + 1];
		int count = 0;
		for (int i = 0; i < n; i++) {
			String s = sc.nextLine();
			for (int j = 0; j < m; j++) {
				a[i][j] = (s.charAt(j) == '.' ? 0 : 1);
				if (a[i][j] == 0)
					count++;
			}
		}
		if (count == 0 & n == 3 & m == 3) {
			System.out.println("NO");
			return;
		}
		if (count == n * m) {
			System.out.println("YES");
			return;
		}
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int sum = 0;
			for (int j = 0; j < m; j++) {
				sum += a[i][j];
			}
			if (sum % 3 == 1) {
				System.out.println("NO");
				return;
			}
			if (sum == 3)
				counter++;
		}
		if (counter == 3 && n - 2 == 3) {
			System.out.println("NO");
			return;
		}
		System.out.println("YES");
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}

import java.io.*;
import java.util.StringTokenizer;

public class DeathNote {
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int a[][] = new int[n][m];
		int count = 0;
		for (int i = 0; i < n; i++) {
			String s = sc.nextLine();
			for (int j = 0; j < m; j++) {
				a[i][j] = (s.charAt(j) == '.' ? 0 : 1);
				if (a[i][j] == 0)
					count++;
			}
		}
		if (count == 0 & n == 3 & m == 3) {
			System.out.println("NO");
			return;
		}
		if (count == n * m) {
			System.out.println("YES");
			return;
		}
		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {
				if (n == 4) {
					int countThree = 0;
					for (int k = 0; k < n - 1; k++)
						for (int l = 1; l <= m - 1; l++)
							countThree += a[k][l];
					if (countThree == 9) {
						System.out.println("NO");
						return;
					}

				}
				if (a[i][j] == 0) {
					if (!((a[i][j - 1] == 1) && (a[i][j + 1] == 1) && (a[i - 1][j - 1] == 1) && (a[i - 1][j + 1] == 1)
							&& a[i - 1][j] == 1 && a[i + 1][j] == 1 && a[i + 1][j - 1] == 1 && a[i + 1][j + 1] == 1)) {
						System.out.println("NO");
						return;
					}
				}
			}
		}
		System.out.println("YES");
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;

public class q2 {
    public static MyScanner in = new MyScanner();
    public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out), true);
    public static MyViewer view = new MyViewer();
    public static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
    public static Random rand = new Random(System.currentTimeMillis());

    public static class Pair<A, B> {
        private final A first;
        private final B second;

        public Pair(A first, B second) {
            super();
            this.first = first;
            this.second = second;
        }

        public int hashCode() {
            int hashFirst = first != null ? first.hashCode() : 0;
            int hashSecond = second != null ? second.hashCode() : 0;

            return (hashFirst + hashSecond) * hashSecond + hashFirst;
        }

        public boolean equals(Object other) {
            if (other instanceof Pair) {
                Pair otherPair = (Pair) other;
                return
                        ((this.first == otherPair.first ||
                                (this.first != null && otherPair.first != null &&
                                        this.first.equals(otherPair.first))) &&
                                (this.second == otherPair.second ||
                                        (this.second != null && otherPair.second != null &&
                                                this.second.equals(otherPair.second))));
            }

            return false;
        }

        public String toString() {
            return "(" + first + ", " + second + ")";
        }

        public A getFirst() {
            return first;
        }

        public B getSecond() {
            return second;
        }
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        private boolean randomInput = false;
        private Random rand;

        void randomInput(boolean r) {
            randomInput = r;
            rand = new Random(System.currentTimeMillis());
            //rand = new Random(42);
        }

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public MyScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int nextInt(int val) {
            return randomInput ? val : Integer.parseInt(next());
        }

        public int nextInt(int low, int high) {
            if (randomInput) {
                return rand.nextInt(high - low + 1) + low;
            } else {
                return Integer.parseInt(next());
            }
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long nextLong(long val) {
            return randomInput ? val : Long.parseLong(next());
        }

        long nextLong(long low, long high) {
            if (randomInput) {
                return low + ((long) (rand.nextDouble() * (high - low + 1)));
            } else {
                return Long.parseLong(next());
            }
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] arrayInt(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        int[] arrayInt(int n, int low, int high) {
            int[] a = new int[n];
            if (randomInput) {
                for (int i = 0; i < n; i++) {
                    a[i] = rand.nextInt(high - low + 1) + low;
                }
            } else {
                for (int i = 0; i < n; i++) {
                    a[i] = nextInt();
                }
            }
            return a;
        }

        ArrayList<Integer> list(int n) {
            ArrayList<Integer> a = new ArrayList<Integer>(n);
            for (int i = 0; i < n; i++) {
                a.add(nextInt());
            }
            return a;
        }

        ArrayList<Integer> list(int n, int low, int high) {
            ArrayList<Integer> a = new ArrayList<Integer>(n);
            if (randomInput) {
                for (int i = 0; i < n; i++) {
                    a.add(rand.nextInt(high - low + 1) + low);
                }
            } else {
                for (int i = 0; i < n; i++) {
                    a.add(nextInt());
                }
            }
            return a;
        }

        long[] arrayLong(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        long[] arrayLong(int n, long low, long high) {
            long[] a = new long[n];
            if (randomInput) {
                for (int i = 0; i < n; i++) {
                    double r = rand.nextDouble();
                    a[i] = (long) (r * (double) (high - low + 1)) + low;
                    if (a[i] == 0) {
                        out.println("Ouch : " + r);
                    }
                }
            } else {
                for (int i = 0; i < n; i++) {
                    a[i] = nextLong();
                }
            }
            return a;
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        ArrayList<ArrayList<Integer>> randomTree(int n) {
            ArrayList<ArrayList<Integer>> edges = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                edges.add(new ArrayList<>());
            }

            for (int i = 1; i < n; i++) {
                int par = rand.nextInt(i);
                edges.get(par).add(i);
            }
            return edges;
        }
    }

    static class MyViewer {
        private static boolean print = true;

        public void on() {
            print = true;
        }

        public void off() {
            print = false;
        }

        public <T extends List> void list(T a) {
            if (!print) return;
            if (a == null) {
                out.println("List: NULL");
                return;
            }
            if (a.size() == 0) {
                out.println("List: []");
                return;
            }
            out.print("List: [" + a.get(0));
            for (int i = 1; i < a.size(); i++) {
                out.print(", " + a.get(i));
            }
            out.println("] Len: " + a.size());
        }

        public <T extends Number> void array(T[] a) {
            if (!print) return;
            if (a == null) {
                out.println("Array: NULL");
                return;
            }
            if (a.length == 0) {
                out.println("Array: []");
                return;
            }
            out.print("Array: [" + a[0]);
            for (int i = 1; i < a.length; i++) {
                out.print(", " + a[i]);
            }
            out.println("] Len: " + a.length);
        }

        public void array(boolean[] a) {
            if (!print) return;
            if (a == null) {
                out.println("boolean[]: NULL");
                return;
            }
            if (a.length == 0) {
                out.println("boolean[]: Len: 0");
                return;
            }
            out.print("boolean[] Len: " + a.length + " [");
            for (boolean x : a) {
                out.print(x + ", ");
            }
            out.println("\b\b]");
        }

//        public void array(int[] a) {
//            if (!print) return;
//
//            if( a == null) {
//                out.println("Array: NULL");
//                return;
//            }
//            if( a.length == 0) {
//                out.println("Array: []");
//                return;
//            }
//            out.print("int[] Len: " + a.length + " [");
//            for (int x : a) {
//                out.print(x + ", ");
//            }
//            out.println("\b\b]");
//        }
//
//        public void array(long[] a) {
//            if (!print) return;
//            if( a == null) {
//                out.println("Array: NULL");
//                return;
//            }
//            if( a.length == 0) {
//                out.println("Array: []");
//                return;
//            }
//            out.print("long Array: [");
//            for (long x : a) {
//                out.print(x + ", ");
//            }
//            out.println("\b\b] Len: " + a.length);
//        }

        public <T extends Number> void matrix(T[][] a, int cutoffRowCol) {
            if (cutoffRowCol == 0)
                cutoffRowCol = Integer.MAX_VALUE;
            if (a == null) {
                out.println("Matrix: NULL");
                return;
            }
            for (int i = 0; i < a.length; i++) {
                if (i < cutoffRowCol) {
                    printMatrixRow(a[i], cutoffRowCol);
                } else {
                    out.println("     ...");
                    printMatrixRow(a[a.length - 1], cutoffRowCol);
                    break;
                }
            }
        }

//        public void matrix(long[][] a, long cutoff) {
//            if (cutoff == 0)
//                cutoff = Long.MAX_VALUE;
//            if( a == null) {
//                out.println("Matrix: NULL");
//                return;
//            }
//            for (int i = 0; i < a.length; i++) {
//                if (i < cutoff) {
//                    printMatrixRow(a[i], cutoff);
//                } else {
//                    out.println("     ...");
//                    printMatrixRow(a[a.length - 1], cutoff);
//                    break;
//                }
//            }
//        }

        public void matrix(boolean[][] a, int cutoffRowCol) {
            if (cutoffRowCol == 0)
                cutoffRowCol = Integer.MAX_VALUE;
            if (a == null) {
                out.println("Matrix: NULL");
                return;
            }
            for (int i = 0; i < a.length; i++) {
                if (i < cutoffRowCol) {
                    printMatrixRow(a[i], cutoffRowCol);
                } else {
                    out.println("     ...");
                    printMatrixRow(a[a.length - 1], cutoffRowCol);
                    break;
                }
            }
        }

        private <T extends Number> void printMatrixRow(T[] a, int cutoff) {
            for (int j = 0; j < a.length; j++) {
                if (j < cutoff) {
                    out.printf("%6d  ", a[j]);
                } else {
                    out.printf(" ... %6d", a[a.length - 1]);
                    break;
                }
            }
            out.println();
        }

//        private void printMatrixRow(long[] a, long cutoff) {
//            for (int j = 0; j < a.length; j++) {
//                if (j < cutoff) {
//                    out.printf("%6d  ", a[j]);
//                } else {
//                    out.printf(" ... %6d", a[a.length - 1]);
//                    break;
//                }
//            }
//            out.println();
//        }

        private void printMatrixRow(boolean[] a, int cutoff) {
            for (int j = 0; j < a.length; j++) {
                if (j < cutoff) {
                    out.print(a[j] ? "T " : "F ");
                } else {
                    out.print(" ... " + (a[a.length - 1] ? "T" : "F"));
                    break;
                }
            }
            out.println();
        }

    }

    public static void main(String[] args) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();

        String[] a = new String[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLine();
        }

        int[][] z = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                z[i][j] = a[i].charAt(j) == '#' ? 1 : 0;
            }
        }

        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                boolean paint = true;
                for (int x = -1; x < 2; x++) {
                    for (int y = -1; y < 2; y++) {
                        if (x == 0 && y == 0)
                            continue;
                        if (z[x + i][y + j] == 0) {
                            paint = false;
                        }
                    }
                }
                if (paint) {
                    for (int x = -1; x < 2; x++) {
                        for (int y = -1; y < 2; y++) {
                            if (x == 0 && y == 0)
                                continue;
                            if( z[x + i][y + j] == 1)
                                z[x + i][y + j] = 2;
                        }
                    }
                }
            }
        }

        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                if( z[i][j] == 1) {
                    out.println("NO");
                    System.exit(0);
                }
            }
        }
        out.println("YES");

        log.flush();
        in.close();
    }
}

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;

public class q2 {
    public static MyScanner in = new MyScanner();
    public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out), true);
    public static MyViewer view = new MyViewer();
    public static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
    public static Random rand = new Random(System.currentTimeMillis());

    public static class Pair<A, B> {
        private final A first;
        private final B second;

        public Pair(A first, B second) {
            super();
            this.first = first;
            this.second = second;
        }

        public int hashCode() {
            int hashFirst = first != null ? first.hashCode() : 0;
            int hashSecond = second != null ? second.hashCode() : 0;

            return (hashFirst + hashSecond) * hashSecond + hashFirst;
        }

        public boolean equals(Object other) {
            if (other instanceof Pair) {
                Pair otherPair = (Pair) other;
                return
                        ((this.first == otherPair.first ||
                                (this.first != null && otherPair.first != null &&
                                        this.first.equals(otherPair.first))) &&
                                (this.second == otherPair.second ||
                                        (this.second != null && otherPair.second != null &&
                                                this.second.equals(otherPair.second))));
            }

            return false;
        }

        public String toString() {
            return "(" + first + ", " + second + ")";
        }

        public A getFirst() {
            return first;
        }

        public B getSecond() {
            return second;
        }
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        private boolean randomInput = false;
        private Random rand;

        void randomInput(boolean r) {
            randomInput = r;
            rand = new Random(System.currentTimeMillis());
            //rand = new Random(42);
        }

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public MyScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int nextInt(int val) {
            return randomInput ? val : Integer.parseInt(next());
        }

        public int nextInt(int low, int high) {
            if (randomInput) {
                return rand.nextInt(high - low + 1) + low;
            } else {
                return Integer.parseInt(next());
            }
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long nextLong(long val) {
            return randomInput ? val : Long.parseLong(next());
        }

        long nextLong(long low, long high) {
            if (randomInput) {
                return low + ((long) (rand.nextDouble() * (high - low + 1)));
            } else {
                return Long.parseLong(next());
            }
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] arrayInt(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        int[] arrayInt(int n, int low, int high) {
            int[] a = new int[n];
            if (randomInput) {
                for (int i = 0; i < n; i++) {
                    a[i] = rand.nextInt(high - low + 1) + low;
                }
            } else {
                for (int i = 0; i < n; i++) {
                    a[i] = nextInt();
                }
            }
            return a;
        }

        ArrayList<Integer> list(int n) {
            ArrayList<Integer> a = new ArrayList<Integer>(n);
            for (int i = 0; i < n; i++) {
                a.add(nextInt());
            }
            return a;
        }

        ArrayList<Integer> list(int n, int low, int high) {
            ArrayList<Integer> a = new ArrayList<Integer>(n);
            if (randomInput) {
                for (int i = 0; i < n; i++) {
                    a.add(rand.nextInt(high - low + 1) + low);
                }
            } else {
                for (int i = 0; i < n; i++) {
                    a.add(nextInt());
                }
            }
            return a;
        }

        long[] arrayLong(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        long[] arrayLong(int n, long low, long high) {
            long[] a = new long[n];
            if (randomInput) {
                for (int i = 0; i < n; i++) {
                    double r = rand.nextDouble();
                    a[i] = (long) (r * (double) (high - low + 1)) + low;
                    if (a[i] == 0) {
                        out.println("Ouch : " + r);
                    }
                }
            } else {
                for (int i = 0; i < n; i++) {
                    a[i] = nextLong();
                }
            }
            return a;
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        ArrayList<ArrayList<Integer>> randomTree(int n) {
            ArrayList<ArrayList<Integer>> edges = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                edges.add(new ArrayList<>());
            }

            for (int i = 1; i < n; i++) {
                int par = rand.nextInt(i);
                edges.get(par).add(i);
            }
            return edges;
        }
    }

    static class MyViewer {
        private static boolean print = true;

        public void on() {
            print = true;
        }

        public void off() {
            print = false;
        }

        public <T extends List> void list(T a) {
            if (!print) return;
            if (a == null) {
                out.println("List: NULL");
                return;
            }
            if (a.size() == 0) {
                out.println("List: []");
                return;
            }
            out.print("List: [" + a.get(0));
            for (int i = 1; i < a.size(); i++) {
                out.print(", " + a.get(i));
            }
            out.println("] Len: " + a.size());
        }

        public <T extends Number> void array(T[] a) {
            if (!print) return;
            if (a == null) {
                out.println("Array: NULL");
                return;
            }
            if (a.length == 0) {
                out.println("Array: []");
                return;
            }
            out.print("Array: [" + a[0]);
            for (int i = 1; i < a.length; i++) {
                out.print(", " + a[i]);
            }
            out.println("] Len: " + a.length);
        }

        public void array(boolean[] a) {
            if (!print) return;
            if (a == null) {
                out.println("boolean[]: NULL");
                return;
            }
            if (a.length == 0) {
                out.println("boolean[]: Len: 0");
                return;
            }
            out.print("boolean[] Len: " + a.length + " [");
            for (boolean x : a) {
                out.print(x + ", ");
            }
            out.println("\b\b]");
        }

//        public void array(int[] a) {
//            if (!print) return;
//
//            if( a == null) {
//                out.println("Array: NULL");
//                return;
//            }
//            if( a.length == 0) {
//                out.println("Array: []");
//                return;
//            }
//            out.print("int[] Len: " + a.length + " [");
//            for (int x : a) {
//                out.print(x + ", ");
//            }
//            out.println("\b\b]");
//        }
//
//        public void array(long[] a) {
//            if (!print) return;
//            if( a == null) {
//                out.println("Array: NULL");
//                return;
//            }
//            if( a.length == 0) {
//                out.println("Array: []");
//                return;
//            }
//            out.print("long Array: [");
//            for (long x : a) {
//                out.print(x + ", ");
//            }
//            out.println("\b\b] Len: " + a.length);
//        }

        public <T extends Number> void matrix(T[][] a, int cutoffRowCol) {
            if (cutoffRowCol == 0)
                cutoffRowCol = Integer.MAX_VALUE;
            if (a == null) {
                out.println("Matrix: NULL");
                return;
            }
            for (int i = 0; i < a.length; i++) {
                if (i < cutoffRowCol) {
                    printMatrixRow(a[i], cutoffRowCol);
                } else {
                    out.println("     ...");
                    printMatrixRow(a[a.length - 1], cutoffRowCol);
                    break;
                }
            }
        }

//        public void matrix(long[][] a, long cutoff) {
//            if (cutoff == 0)
//                cutoff = Long.MAX_VALUE;
//            if( a == null) {
//                out.println("Matrix: NULL");
//                return;
//            }
//            for (int i = 0; i < a.length; i++) {
//                if (i < cutoff) {
//                    printMatrixRow(a[i], cutoff);
//                } else {
//                    out.println("     ...");
//                    printMatrixRow(a[a.length - 1], cutoff);
//                    break;
//                }
//            }
//        }

        public void matrix(boolean[][] a, int cutoffRowCol) {
            if (cutoffRowCol == 0)
                cutoffRowCol = Integer.MAX_VALUE;
            if (a == null) {
                out.println("Matrix: NULL");
                return;
            }
            for (int i = 0; i < a.length; i++) {
                if (i < cutoffRowCol) {
                    printMatrixRow(a[i], cutoffRowCol);
                } else {
                    out.println("     ...");
                    printMatrixRow(a[a.length - 1], cutoffRowCol);
                    break;
                }
            }
        }

        private <T extends Number> void printMatrixRow(T[] a, int cutoff) {
            for (int j = 0; j < a.length; j++) {
                if (j < cutoff) {
                    out.printf("%6d  ", a[j]);
                } else {
                    out.printf(" ... %6d", a[a.length - 1]);
                    break;
                }
            }
            out.println();
        }

//        private void printMatrixRow(long[] a, long cutoff) {
//            for (int j = 0; j < a.length; j++) {
//                if (j < cutoff) {
//                    out.printf("%6d  ", a[j]);
//                } else {
//                    out.printf(" ... %6d", a[a.length - 1]);
//                    break;
//                }
//            }
//            out.println();
//        }

        private void printMatrixRow(boolean[] a, int cutoff) {
            for (int j = 0; j < a.length; j++) {
                if (j < cutoff) {
                    out.print(a[j] ? "T " : "F ");
                } else {
                    out.print(" ... " + (a[a.length - 1] ? "T" : "F"));
                    break;
                }
            }
            out.println();
        }

    }

    public static void main(String[] args) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();

        String[] a = new String[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLine();
        }

        int[][] z = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                z[i][j] = a[i].charAt(j) == '#' ? 1 : 0;
            }
        }

        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                boolean paint = true;
                for (int x = -1; x < 2; x++) {
                    for (int y = -1; y < 2; y++) {
                        if (x == 0 && y == 0)
                            continue;
                        if (z[x + i][y + j] == 0) {
                            paint = false;
                        }
                    }
                }
                if (paint) {
                    for (int x = -1; x < 2; x++) {
                        for (int y = -1; y < 2; y++) {
                            if (x == 0 && y == 0)
                                continue;
                            z[x + i][y + j] = 2;
                        }
                    }
                }
            }
        }

        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                if( z[i][j] == 1) {
                    out.println("NO");
                    System.exit(0);
                }
            }
        }
        out.println("YES");

        log.flush();
        in.close();
    }
}

import java.io.*;
import java.math.*;
import java.util.*;
@SuppressWarnings("Duplicates")
// author @mdazmat9
public class codeforces{
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) throws IOException {
        int test = 1;
         //test=sc.nextInt();
        for (int ind = 0; ind < test; ind++) {
         solve();
        }
        out.flush();
    }
    static void solve(){
        int n = sc.nextInt();
        int m=sc.nextInt();
        char[][]a =char2darray(n,m);
        char[][]b=new char[n][m];
        for(int i=0;i<n;i++){
            Arrays.fill(b[i],'.');
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if (a[i][j] == '.') {
                    boolean bool=false;
                    if(i-1>=0 && i+1<n && j-1>=0 && j+1<m){
                        if( a[i-1][j-1]=='#'  && a[i-1][j]=='#' &&  a[i-1][j+1]=='#'  && a[i][j-1]=='#' &&   a[i][j+1]=='#'  && a[i+1][j-1]=='#' &&  a[i+1][j]=='#'  && a[i+1][j+1]=='#'){
                            b[i-1][j-1] = b[i-1][j] = b[i-1][j+1]= b[i][j-1] = b[i][j+1] = b[i+1][j-1]= b[i+1][j]=b[i+1][j+1]='#';
                        }
                    }
                }
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
               if(a[i][j]!=b[i][j]){
                   out.println("NO");
                   return;
               }
            }
        }

        out.println("YES");
    }

    static int[] intarray(int n){ int [] a=new int[n];for(int i=0;i<n;i++)a[i]=sc.nextInt();return a; }
    static long[] longarray(int n){ long [] a=new long[n];for(int i=0;i<n;i++)a[i]=sc.nextLong();return a; }
    static ArrayList<Integer> intlist(int n){ArrayList<Integer> list=new ArrayList<>();for(int i=0;i<n;i++)list.add(sc.nextInt());return list; }
    static ArrayList<Long> longlist(int n){ArrayList<Long> list=new ArrayList<>();for(int i=0;i<n;i++)list.add(sc.nextLong());return list; }
    static int[][] int2darray(int n,int m){ int [][] a=new int[n][m];for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ a[i][j]=sc.nextInt(); } }return a; }
    static long[][] long2darray(int n,int m){ long [][] a=new long[n][m];for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ a[i][j]=sc.nextLong(); } }return a; }
    static char[][] char2darray(int n,int m){ char [][] a=new char[n][m];for(int i=0;i<n;i++){ String s=sc.next(); a[i]=s.toCharArray(); }return a; }

    static double pi=3.14159265358979323846264;
    public static double logb( double a, double b ) {return Math.log(a) / Math.log(b); }
    static long fast_pow(long a, long b,long abs) {
        if(b == 0) return 1L;
        long val = fast_pow(a, b / 2,abs);
        if(b % 2 == 0) return val * val % abs;
        else return val * val % abs * a % abs;
    }
    static long abs = (long)1e9 + 7;
    static   void shuffle(int[] a) { int n = a.length;for(int i = 0; i < n; i++) { int r = i + (int) (Math.random() * (n - i));int tmp = a[i];a[i] = a[r];a[r] = tmp; } }
    static long gcd(long a , long b) {
        if(b == 0) return a;
        return gcd(b , a % b);
    }
}

class Scanner {
    public BufferedReader reader;
    public StringTokenizer st;
    public Scanner(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        st = null;
    }
    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            } catch (Exception e) {
                throw (new RuntimeException());
            }
        }
        return st.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        int n = in.nextInt();
        int m = in.nextInt();
        char[][]mat = new char[n][m];
        for (int i =0;i<n;i++)
        {
            String s = in.readString();
            for (int j =0;j<m;j++)
            {
                mat[i][j]= s.charAt(j);
            }
        }
        boolean check= true;
        boolean[][] visit = new boolean[n][m];
        for (int i=0;i<=n-3;i++)
        {
            for (int j=0;j<=m-3;j++)
            {
                if (mat[i][j]=='#')
                {
                    for (int k1=0;k1<3;k1++)
                    {
                        for (int k2=0;k2<3;k2++)
                        {
                            if (k1!=1||k2!=1)
                            {
                                if (mat[i][j]=='.')
                                {
                                    break;
                                }
                                else
                                    visit[i+k1][j+k2]=true;
                            }

                        }
                    }
                }

            }
        }
        for (int i =0;i<n;i++)
            for (int j=0;j<m;j++)
                if (mat[i][j]=='#'&&!visit[i][j])
                    check=false;
 out.printLine(check?"YES":"NO");
        out.flush();

    }

}

class pair  implements Comparable
{

    int key;
    int value;
    public pair(Object key, Object value) {

        this.key = (int)key;
        this.value=(int)value;
    }

    @Override
    public int compareTo(Object o) {
        pair temp =(pair)o;
        return  key-temp.key;
    }
}
class Graph {

    int n;
    ArrayList<Integer>[] adjList;

    public Graph(int n) {
        this.n = n;
        adjList = new ArrayList[n];
        for (int i = 0; i < n; i++)
            adjList[i] = new ArrayList<>();
    }

}

class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (snumChars == -1)
            throw new InputMismatchException();
        if (curChar >= snumChars) {
            curChar = 0;
            try {
                snumChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (snumChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public int[] nextIntArray(int n) {
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }

}

import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        int n = in.nextInt();
        int m = in.nextInt();
        char[][]mat = new char[n][m];
        for (int i =0;i<n;i++)
        {
            String s = in.readString();
            for (int j =0;j<m;j++)
            {
                mat[i][j]= s.charAt(j);
            }
        }
        if (n==3&&m==3&&mat[1][1]=='#')
        {
            out.printLine("NO");
        }
        else
            out.printLine("YES");

        out.flush();

    }

}

class pair  implements Comparable
{

    int key;
    int value;
    public pair(Object key, Object value) {

        this.key = (int)key;
        this.value=(int)value;
    }

    @Override
    public int compareTo(Object o) {
        pair temp =(pair)o;
        return  key-temp.key;
    }
}
class Graph {

    int n;
    ArrayList<Integer>[] adjList;

    public Graph(int n) {
        this.n = n;
        adjList = new ArrayList[n];
        for (int i = 0; i < n; i++)
            adjList[i] = new ArrayList<>();
    }

}

class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (snumChars == -1)
            throw new InputMismatchException();
        if (curChar >= snumChars) {
            curChar = 0;
            try {
                snumChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (snumChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public int[] nextIntArray(int n) {
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }

}

import java.util.*;
import java.io.*;
public class B {
	public static boolean[][] ink, can;
	public static int n, m;
	public static boolean pos;
	public static int[] dx = { -1, 0, 1 };
	public static int[] dy = { -1, 0, 1 };

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st = new StringTokenizer(br.readLine());
        n = Integer.parseInt(st.nextToken());
        m = Integer.parseInt(st.nextToken());
        ink = new boolean[n][m];
        can = new boolean[n][m];

        for (int i = 0; i < n; i++) {
        	st = new StringTokenizer(br.readLine());
        	String s = st.nextToken();
        	for (int j = 0; j < m; j++) {
        		if (s.charAt(j) == '#') ink[i][j] = true;
        		else ink[i][j] = false;
        		can[i][j] = true;
        	}
        }

        for (int i = 0; i < m; i++) {
        	can[0][i] = false;
        	can[n-1][i] = false;
        }
        for (int i = 1; i < n-1; i++) {
        	can[i][0] = false;
        	can[i][m-1] = false;
        }
        for (int i = 0; i < n; i++) {
        	for (int j = 0; j < m; j++) {
        		if (!ink[i][j]) {
        			for (int k = 0; k < 3; k++) {
        				for (int l = 0; l < 3; l++) {
        					if ((dx[k] != 0 || dy[l] != 0) && i+dx[k] >= 0 && j+dy[l] >= 0 && i+dx[k] < n && j+dy[l] < m)
        						can[i+dx[k]][j+dy[l]] = false;
        				}
        			}
        		}
        	}
        }

        pos = false;
        outer: for (int i = 0; i < n; i++) {
        	for (int j = 0; j < m; j++) {
        		if (ink[i][j]) {
        			pos = false;
        			for (int k = 0; k < 3; k++) {
        				for (int l = 0; l < 3; l++) {
        					if ((dx[k] == 0 && dy[l] == 0) || i+dx[k] < 0 || j+dy[l] < 0 || i+dx[k] >= n || j+dy[l] >= m)
        						continue;
        					if (can[i+dx[k]][j+dy[l]]) {
        						pos = true;
        					}
        				}
        			}
        			if (!pos) break outer;
        		}
        	}
        }
        if (!pos) System.out.println("NO");
        else System.out.println("YES");

	}

}

import java.util.*;
import java.io.*;
public class B {
	public static boolean[][] ink, can;
	public static int n, m;
	public static boolean pos;
	public static int[] dx = { -1, 0, 1 };
	public static int[] dy = { -1, 0, 1 };

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st = new StringTokenizer(br.readLine());
        n = Integer.parseInt(st.nextToken());
        m = Integer.parseInt(st.nextToken());
        ink = new boolean[n][m];
        can = new boolean[n][m];

        for (int i = 0; i < n; i++) {
        	st = new StringTokenizer(br.readLine());
        	String s = st.nextToken();
        	for (int j = 0; j < m; j++) {
        		if (s.charAt(j) == '#') ink[i][j] = true;
        		else ink[i][j] = false;
        		can[i][j] = true;
        	}
        }

        for (int i = 0; i < m; i++) {
        	can[0][i] = false;
        	can[n-1][i] = false;
        }
        for (int i = 1; i < n-1; i++) {
        	can[i][0] = false;
        	can[i][m-1] = false;
        }
        for (int i = 0; i < n; i++) {
        	for (int j = 0; j < m; j++) {
        		if (!ink[i][j]) {
        			for (int k = 0; k < 3; k++) {
        				for (int l = 0; l < 3; l++) {
        					if ((dx[k] != 0 || dy[l] != 0) && i+dx[k] >= 0 && j+dy[l] >= 0 && i+dx[k] < n && j+dy[l] < m)
        						can[i+dx[k]][j+dy[l]] = false;
        				}
        			}
        		}
        	}
        }

        //System.out.println(Arrays.deepToString(ink));
        //System.out.println(Arrays.deepToString(can));

        pos = false;
        boolean pr = false;
        for (int i = 0; i < n; i++) {
        	for (int j = 0; j < m; j++) {
        		if (ink[i][j]) {
        			pos = false;
        			for (int k = 0; k < 3; k++) {
        				for (int l = 0; l < 3; l++) {
        					if ((dx[k] == 0 && dy[l] == 0) || i+dx[k] < 0 || j+dy[l] < 0 || i+dx[k] >= n || j+dy[l] >= m)
        						continue;
        					if (can[i+dx[k]][j+dy[l]]) {
        						pos = true;
        					}
        				}
        			}
        			if (!pos) {
        				System.out.println("NO");
        				pr = true;
        			}

        		}
        	}
        }
        if (!pr) System.out.println("YES");

	}

}

import java.util.Scanner;

public class Forgery {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        boolean[][] c = new boolean[n][m];

        for (int i = 0; i < n; ++i) {
            final String str = scanner.next();
            for (int j = 0; j < m; ++j) {
                c[i][j] = str.charAt(j) == '#';
            }
        }

        for (int i = 1; i < n - 1; ++i) {
            int numOfSpacesInRow = 0;
            for (int j = 1; j < m - 1; ++j) {
                if (!c[i][j] && !surroundedBySharps(c, i, j)) {
                    System.out.println("NO");
                    return;
                }
                if (c[i][j] && surroundedBySharps(c, i, j) && (n + m) % 2 == 0) {
                    System.out.println("NO");
                    return;
                }
                if (!c[i][j]) {
                    numOfSpacesInRow++;
                }
            }
            if ((numOfSpacesInRow + m) % 2 != 0) {
                System.out.println("NO");
                return;
            }
        }

        for (int j = 1; j < m - 1; ++j) {
            int numOfSpacesInColumn = 0;
            for (int i = 1; i < n - 1; ++i) {
                if (!c[i][j]) {
                    numOfSpacesInColumn++;
                }
            }
            if ((numOfSpacesInColumn + n) % 2 != 0) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");
    }

    private static boolean surroundedBySharps(boolean[][] c, int i, int j) {
        return c[i][j + 1] && c[i + 1][j] && c[i + 1][j + 1]
                && c[i - 1][j] && c[i][j - 1] && c[i - 1][j - 1]
                && c[i - 1][j + 1] && c[i + 1][j - 1];
    }
}

import java.util.Scanner;

public class Forgery {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        boolean[][] c = new boolean[n][m];

        for (int i = 0; i < n; ++i) {
            final String str = scanner.next();
            for (int j = 0; j < m; ++j) {
                c[i][j] = str.charAt(j) == '#';
            }
        }

        for (int i = 1; i < n - 1; ++i) {
            for (int j = 1; j < m - 1; ++j) {
                if (!c[i][j] && !surroundedBySharps(c, i, j)) {
                    System.out.println("NO");
                    return;
                }
                if (c[i][j] && surroundedBySharps(c, i, j) && (n + m) % 2 == 0) {
                    System.out.println("NO");
                    return;
                }
            }
        }

        System.out.println("YES");
    }

    private static boolean surroundedBySharps(boolean[][] c, int i, int j) {
        return c[i][j + 1] && c[i + 1][j] && c[i + 1][j + 1]
                && c[i - 1][j] && c[i][j - 1] && c[i - 1][j - 1]
                && c[i - 1][j + 1] && c[i + 1][j - 1];
    }
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static long sx = 0, sy = 0, mod = (long) (1e9 + 7);

	static ArrayList<Integer>[] a;
	static int[][][] dp;
	static long[] fa;
	static long[] farr;
	public static PrintWriter out;
	static ArrayList<pair> pa = new ArrayList<>();
	static long[] fact = new long[(int) 1e6];
	static StringBuilder sb = new StringBuilder();
	static boolean cycle = false;
	static long m = 998244353;
	static long[] no, col;
	// static String s;
	static long k = 0, n = 0;
	static int[] c;
	static long ans = 0;
	static int[] down;
	static int[] score;

	static HashMap<Integer, ArrayList<Integer>> hm;

	public static void main(String[] args) throws IOException {

		Scanner scn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		out = new PrintWriter(System.out);
		// Reader scn = new Reader();

		int n = scn.nextInt(), m = scn.nextInt();

		char[][] a = new char[n][m];
		char[][] b = new char[n][m];

		for (int i = 0; i < n; i++) {
			String s = scn.next();
			Arrays.fill(b[i], '.');
			for (int j = 0; j < m; j++)
				a[i][j] = s.charAt(j);
		}

		for (int i = 0; i < n-2; i++) {

			for (int j = 1; j < m - 1; j++) {

				if (a[i][j] == '#' && b[i][j] == '.') {

					if (a[i][j - 1] == '#' && a[i][j + 1] == '#')
						fill(b, i + 1, j);

					if (a[i][j - 1] == '#' && a[i][j + 1] != '#')
						fill(b, i + 1, j - 1);
				}
			}
		}

		if (isequsl(a, b))
			System.out.println("YES");
		else
			System.out.println("NO");

	}

	private static boolean isequsl(char[][] a, char[][] b) {

		for (int i = 0; i < a.length; i++)
			for (int j = 0; j < a[0].length; j++)
				if (a[i][j] != b[i][j])
					return false;

		return true;
	}

	private static void fill(char[][] b, int i, int j) {

		for (int c = j - 1; c <= j + 1; c++) {
			b[i - 1][c] = '#';
			b[i + 1][c] = '#';
		}

		for (int r = i - 1; r <= i + 1; r++) {
			b[r][j - 1] = '#';
			b[r][j + 1] = '#';
		}
	}

	// _________________________TEMPLATE_____________________________________________________________

	// public static long lcm(long x, long y) {
	//
	// return (x * y) / gcd(x, y);
	// }
	//
	// private static long gcd(long x, long y) {
	// if (x == 0)
	// return y;
	//
	// return gcd(y % x, x);
	// }
	//
	// static class comp implements Comparator<Integer> {
	//
	// @Override
	// public int compare(Integer p1, Integer p2) {
	//
	// return p2 - p1;
	//
	// }
	// }
	//
	// }
	//
	// public static long pow(long a, long b) {
	//
	// if (b < 0)
	// return 0;
	// if (b == 0 || b == 1)
	// return (long) Math.pow(a, b);
	//
	// if (b % 2 == 0) {
	//
	// long ret = pow(a, b / 2);
	// ret = (ret % mod * ret % mod) % mod;
	// return ret;
	// }
	//
	// else {
	// return ((pow(a, b - 1) % mod) * a % mod) % mod;
	// }
	// }

	private static class pair implements Comparable<pair> {

		long val;
		long t;

		pair(long a, long b) {
			val = a;
			t = b;
		}

		@Override
		public int compareTo(pair o) {

			return (int) (this.val - o.val);
		}

		// @Override
		//
		// public int hashCode() {
		// return i;
		// }
		//
		// @Override
		//
		// public boolean equals(Object o) {
		//
		// pair p = (pair) o;
		// return this.i == p.i;
		// }

	}

	private static String reverse(String s) {

		return new StringBuilder(s).reverse().toString();
	}

	public static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[1000000 + 1]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}

		public int[][] nextInt2DArray(int m, int n) throws IOException {
			int[][] arr = new int[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}

		public long[][] nextInt2DArrayL(int m, int n) throws IOException {
			long[][] arr = new long[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}
		// kickstart - Solution
		// atcoder - Main
	}

}