module Main where
import qualified Data.Vector.Unboxed.Mutable as MV
import qualified Data.Vector.Unboxed as V
import Control.Monad

readL :: Read a => IO [a]
readL = map read . words <$> getLine

main = do
  [n, q] <- readL
  edges <- replicateM (n-1) $ fmap (\[p, q] -> (p-1, q-1)) readL
  counters <- MV.replicate n 0
  ops <- replicateM q $ do
    [p, x] <- readL
    MV.modify counters (+x) (p-1)
  forM_ edges $ \(p, q) -> do
    v <- MV.read counters p
    MV.modify counters (+v) q
  V.unsafeFreeze counters >>= print
