N, Q = gets.split.map(&:to_i)
link = []
(N-1).times do
  link << gets.split.map(&:to_i)
end
px = []
Q.times do
  px << gets.split.map(&:to_i)
end

ans = Array.new(N, 0)
px.each do |posi, point|
  ans[posi-1] += point
end
link.each do |a, b|
  ans[b-1] += ans[a-1]
end

puts ans.join(' ')
