import java.util.Scanner; public class Main_yukicoder179 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int w = sc.nextInt(); char[][] s = new char[h][]; int black = 0; for (int i = 0; i < h; i++) { s[i] = sc.next().toCharArray(); for (int j = 0; j < s[i].length; j++) { if (s[i][j] == '#') { black++; } } } boolean flag = false; if (black != 0 && black % 2 == 0) { fin: for (int dx = - w + 1; dx <= w - 1; dx++) { for (int dy = - h + 1; dy <= h - 1; dy++) { int same = 0; // next: for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (i + dy >= 0 && i + dy < h && j + dx >= 0 && j + dx < w) { // if (s[i][j] != s[i + dy][j + dx]) { // break next; // } if (s[i][j] == '#' && s[i + dy][j + dx] == '#') { same++; } } } } if (same == (black / 2)) { boolean[][] used = new boolean[h][w]; flag = true; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (i + dy >= 0 && i + dy < h && j + dx >= 0 && j + dx < w) { if (s[i][j] == '#' && !used[i][j]) { if (s[i + dy][j + dx] == '#' && !used[i + dy][j + dx]) { used[i][j] = true; used[i + dy][j + dx] = true; } else { flag = false; } } } } } if (flag) { // System.out.println(dx + " " + dy); break fin; } } } } } if (flag) { System.out.println("YES"); } else { System.out.println("NO"); } sc.close(); } }