import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int h = Integer.parseInt(sa[0]); int w = Integer.parseInt(sa[1]); char[][] a = new char[h][w]; for (int i = 0; i < h; i++) { a[i] = br.readLine().toCharArray(); } br.close(); boolean[] h0 = new boolean[h]; boolean[] h1 = new boolean[h]; for (int i = 0; i < h; i++) { boolean f0 = true; boolean f1 = true; for (int j = 0; j < w; j++) { if (a[i][j] == '0') { f1 = false; } else { f0 = false; } } h0[i] = f0; h1[i] = f1; } boolean[] w0 = new boolean[w]; boolean[] w1 = new boolean[w]; for (int j = 0; j < w; j++) { boolean f0 = true; boolean f1 = true; for (int i = 0; i < h; i++) { if (a[i][j] == '0') { f1 = false; } else { f0 = false; } } w0[j] = f0; w1[j] = f1; } for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (h0[i] && w0[j] || h1[i] && w1[j]) { System.out.println("NO"); return; } } } System.out.println("YES"); } }