import sys N,M=map(int,input().split()) table=[0]*N for k in range(M): V=0 a=list(map(int,input().split())) j=0 for i in range(N): table[i]+=a[i] V+=table[i] if V<777: pass elif V==777: print('YES') sys.exit() else: while j777: V-=table[j] j+=1 if V==777: print('YES') sys.exit() print('NO')