N,Q=gets.split.map(&:to_i)

tree = {}
(N-1).times do
  a,b = gets.split.map(&:to_i)
  tree[a] ||= []
  tree[a] << b
  tree[b] ||= []
  tree[b] << a
end

score = Array.new(N+1,0)
Q.times do
  p,x = gets.split.map(&:to_i)
  score[p] += x
end

ret = Array.new(N+1,0)
check = Array.new(N+1,0)
q = [[1, score[1]]]
# n = node, s = score
until q.empty?
  n, s = q.shift
  next if check[n] != 0
  check[n] = 1
  ret[n] = s
  (tree[n]||[]).each do |child|
    q << [child,s+score[child]]
  end
end
# p ret, tree, score

ret.shift