import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class No179 { public static void main(String[] args) throws IOException { String[] text = readStr(); int h = Integer.parseInt(text[0].split(" ")[0]); int w = Integer.parseInt(text[0].split(" ")[1]); String[][] strings = new String[h][w]; for(int i = 0;i < h;i++) { strings[i]= text[i+1].split(""); } int sh = -1,sw = -1; for(int i = 0;i < h;i++) { for(int j = 0;j < w;j++) { if("#".equals(strings[i][j])){ sh = i; sw = j; break; } } if(Math.min(sh, sw)>=0){ break; } } if(Math.min(sh, sw) == -1) { System.out.println("NO"); System.exit(0); } boolean ans = false; for(int i = 0;i < h;i++) { for(int j = -1*w+1;j < w;j++) { if(i == 0 && j <= 0) { continue; } ans = checkPaint(i, j, strings, sh); if(ans) { break; } } if(ans) { break; } } if(ans) { System.out.println("YES"); }else { System.out.println("NO"); } } public static boolean checkPaint(int h,int w,String[][] str,int sh) { boolean ans = true; String[][] strings = new String[str.length][str[0].length]; for (int i = 0;i < str.length;i++) { for(int j = 0;j < str[0].length;j++) { strings[i][j]= str[i][j]; } } for(int i = sh;i < strings.length;i++) { for(int j = 0;j < strings[0].length;j++) { if("#".equals(strings[i][j])){ if(i + h >= strings.length || j + w < 0 || j + w >= strings[0].length) { ans = false; break; } if(!"#".equals(strings[i+h][j+w])) { ans = false; break; } strings[i+h][j+w] = "."; } } if(!ans) { break; } } return ans; } public static String[] readStr() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList list = new ArrayList<>(); do { list.add(br.readLine()); }while(br.ready()); br.close(); String[] text = new String[list.size()]; list.toArray(text); return text; } }