import math import copy def numchk(a,inlist): chklist = [ inlist[i].count(a) for i in range(len(inlist)) ] ret = 0 if chklist != [0] * len(inlist): ret = 1 return ret def connect(inlist,baselist): outlist = [ [ inlist[i][j] + baselist[i][j+len(baselist)-len(inlist[i])+1] for j in range(len(inlist[i])-1) ] for i in range(len(inlist))] return outlist n, m = [ int(v) for v in input().split(" ") ] passenger_list = [] for i in range(m): passenger_list.append([ int(v) for v in input().split(" ") ]) for i in range(m-1): passenger_list[i+1] = [ passenger_list[i+1][j] + passenger_list[i][j] for j in range(n) ] for i in range(m): ans = "NO" if i == 0: nowlist = passenger_list else: nowlist = connect(nowlist,passenger_list) if numchk(777,nowlist) == 1: ans = "YES" print(ans)