N, M = map(int, input().split(' ')) xss = [] for i in range(M): xs = list(map(int, input().split(' ')) ) xss.append( xs ) import copy sums = set() xsn = [] state = xss[0] for s in range(0, N): for e in range(s, N+1): sum_ = sum( state[s:e] ) sums.add( sum_ ) xsn.append( copy.copy(state) ) for xs in xss[1:]: state = [s+x for s, x in zip(state, xs) ] for s in range(0, N): for e in range(s, N+1): sum_ = sum( state[s:e] ) sums.add( sum_ ) #print(s, e, sum_) xsn.append( copy.copy(state) ) #print(xsn) #print(sums) if 777 in sums: print('YES') else: print('NO')