def main(): N, M = map(int, input().split()) A = [0] * N flag = False for _ in range(M): B = list(map(int, input().split())) for i in range(N): A[i] += B[i] for left in range(N): tmp = 0 right = left while right < N: if tmp >= 777: break tmp += A[right] right += 1 if tmp == 777: flag = True if flag: print('YES') else: print('NO') if __name__ == "__main__": main()