N,M=map(int,raw_input().split()) S = [map(int,raw_input().split()) for i in xrange(M)] dp = {0:0} for i in xrange(N): tmp_dp = dict() for k,v in dp.iteritems(): for j in xrange(N): bit = 1<= tmp_v): tmp_dp[nk] = tmp_v dp = tmp_dp print dp[2**N-1]