import sys import numpy as np readline = sys.stdin.readline read = sys.stdin.read v, d = map(int, readline().split()) a = [list(map(int,readline().rstrip('\n'))) for i in range(v)] a = np.array(a) ans = "Yes" if np.all(np.linalg.matrix_power(a,d)) else "No" print(ans)