import sys
import math
from collections import deque,Counter
from sys import stdin

#sys.setrecursionlimit(10**7)
int1=lambda x: int(x)-1

inp=lambda :int(input())
mi=lambda :map(int,input().split())
li=lambda :list(mi())
mi1=lambda :map(int1,input().split())
li1=lambda :list(mi1())
mis=lambda :map(str,input().split())
lis=lambda :list(mis())

stinput=lambda :stdin.readline()[:-1]
stinp=lambda :int(stinput())
stmi=lambda :map(int, stdin.readline().split())
stli=lambda :list(stmi())
stmi1=lambda :map(int1, stdin.readline().split())
stli1=lambda :list(stmi1())
stmis=lambda :stdin.readline()[:-1]

pr=print

from collections import defaultdict
"""
#初期値 0
d=defaultdict(int)

#初期値 1
d=defaultdict(lambda:1)
"""

mod=10**9+7
Mod=998244353
INF=10**18
ans=0

n,q=mi()
edge=[[] for i in range(n)]
for i in range(n-1):
  a,b=mi1()
  edge[a].append(b)
  edge[b].append(a)

cnt=[0]*n
seen=[False]*n
def dfs(x):
  seen[x]=True
  tmp=1
  for i in edge[x]:
    if seen[i]==False:
      tmp+=dfs(i)
  cnt[x]=tmp
  return tmp

dfs(0)
for i in range(q):
  p,x=mi()
  ans+=cnt[p-1]*x
  print(ans)