N, M = map(int, input().split()) A = [list() for i in range(M)] for i in range(M): A[i] = list(map(int, input().split())) for i in range(M-1): for j in range(N): A[i+1][j] += A[i][j] for i in range(M): a = A[i] sum = 0 right = 0 for left in range(N): while right < N and sum + a[right] <= 777: sum += a[right] right += 1 #print(i, left, right, sum) if sum == 777: print("YES") exit() if left == right: right += 1 else: sum -= a[left] print("NO")