import sys input=lambda: sys.stdin.readline().rstrip() n,m=map(int,input().split()) T=[0]*n ans=False for _ in range(m): A=[int(i) for i in input().split()] for i in range(n): T[i]+=A[i] l,r=0,1 tot=T[0] while True: if tot>777: tot-=T[l] l+=1 elif tot<777: if r==n: break else: tot+=T[r] r+=1 else: ans=True break else: continue print("YES" if ans else "NO")