def selAux(ord,cand)
  abort("cand strange") if cand.length==0
  if ord.length==0 then
    return cand[0]
  else
    a,b = ord.shift
    selAux(ord, cand.select{|x| x.index(a) < x.index(b)})
  end
end

def sel(ord, n)
  cand = (1..(n-1)).to_a.permutation(n-1).to_a.each{|x| x[x.index(2)]=n}.map{|x| x.push(2)}
  return selAux(ord,cand)
end

def main
  if true then
    fh=STDIN
  else
    fh=open("in1_0119.txt")
  end
  ord=[]
  m =fh.gets.chomp.to_i
  n =fh.gets.chomp.to_i
  0.upto(n-1){|i| 
    f=fh.gets.chomp.split.map{|x| x.to_i}
    ord.push(f)
  }
  puts sel(ord, m)
end
if $0==__FILE__ then
  main
end