N, M = map(int, input().split()) count = [0] * N from collections import deque for _ in range(M): A = list(map(int, input().split())) for i in range(N): count[i] += A[i] q = deque() jokyaku = 0 for c in count: q.append(c) jokyaku += c while q and jokyaku > 777: t = q.popleft() jokyaku -= t if jokyaku == 777: print("YES") exit() print("NO")