n,m = map(int,input().split()) train = [0]*n for i in range(m): cst = list(map(int,input().split())) for j in range(n): train[j] += cst[j] for j in range(n): sum_c = 0 for l in range(j,n): sum_c+=train[l] if sum_c<777: continue elif sum_c==777: print("YES") exit(0) else: break print("NO")