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

par=[]
chi=[]

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

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

res=[]
res[root]=0

que=[root]

until que.empty?
  nd=que.shift
  chi[nd]&&chi[nd].map{|ch|
    par[ch]-=1
    if par[ch]==0
      res[ch]=nd
      que.push(ch)
    end
  }
end

puts res[1,n]
