h, w = map(int, input().split()) grid = [input().strip() for _ in range(h)] all_ones = True count_zeros = 0 for row in grid: if '0' in row: all_ones = False count_zeros += row.count('0') if all_ones: if (h * w) % 2 == 0: print("NO") else: print("YES") else: if count_zeros % 2 == 0: print("YES") else: print("NO")