(n,m),*ab=$<.map{|s|s.split.map &:to_i}

par=[]
chi=[]

ab.map{|a,b|
  par[b]||=[]
  par[b]<<a
  chi[a]||=[]
  chi[a]<<b
}

root=(1..n).find{|i|par[i]==nil}

res=[]
res[root]=0

que=[root]
i=0

until que.size==i
  node=que[i]
  i+=1
  chi[node]&&chi[node].map{|ch|
    if par[ch].count{|c|!res[c]}==0
      res[ch]=node
      que.push(ch) if chi[ch]!=nil
    end
  }
end

puts res[1,n]
