#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
//#define int long long
namespace gtx{
// Fast IO
void read(int &x){
x = 0;int h = 1;char tmp;
do{tmp=getchar();if(tmp=='-')h*=-1;}while(!isdigit(tmp));
while(isdigit(tmp)) x*=10,x+=tmp-'0',tmp=getchar();
x*=h;
}
void read(char &x){do{x=getchar();}while(x==' '||x=='\n'||x=='\r');}
void write(char x){putchar(x);}
void write(int x){
if(x<0) putchar('-'),x=-x;int st[200]={0},tot=0;
do{st[++tot]=x%10,x/=10;} while(x);
while(tot){putchar(st[tot--]+'0');};
}
void write(int x,char y){write(x);write(y);}
const int MAXN = 2e5+10;
int n,q,maxn[MAXN][3],cnt[MAXN][3];
int maxl[MAXN][2],maxlc[MAXN][2];
int sonl[MAXN][4],sonlc[MAXN][4];
int fath[MAXN];
vector<int> v[MAXN];
struct solder{
int b,l;
}a[MAXN];
void modify(int x,int p,int cp){
if(p>maxn[x][0]){
maxn[x][2] = maxn[x][1];
cnt[x][2] = cnt[x][1];
maxn[x][1] = maxn[x][0];
cnt[x][1] = cnt[x][0];
maxn[x][0] = p;
cnt[x][0] = cp;
}else if(p==maxn[x][0]) cnt[x][0]+=cp;
else if(p>maxn[x][1]){
maxn[x][2] = maxn[x][1];
cnt[x][2] = cnt[x][1];
maxn[x][1] = p;
cnt[x][1] = cp;
}else if(p==maxn[x][1]) cnt[x][1]+=cp;
else if(p>maxn[x][2]){
maxn[x][2] = p;
cnt[x][2] = cp;
}else if(p==maxn[x][2]) cnt[x][2]+=cp;
}
void modifyl(int x,int l,int cl){
if(sonl[x][0]<l){
sonl[x][3] = sonl[x][2];
sonlc[x][3] = sonlc[x][2];
sonl[x][2] = sonl[x][1];
sonlc[x][2] = sonlc[x][1];
sonl[x][1] = sonl[x][0];
sonlc[x][1] = sonlc[x][0];
sonl[x][0] = l;
sonlc[x][0] = cl;
}else if(sonl[x][0]==l){
sonlc[x][0] += cl;
}else if(sonl[x][1]<l){
sonl[x][3] = sonl[x][2];
sonlc[x][3] = sonlc[x][2];
sonl[x][2] = sonl[x][1];
sonlc[x][2] = sonlc[x][1];
sonl[x][1] = l;
sonlc[x][1] = cl;
}else if(sonl[x][1]==l){
sonlc[x][1] += cl;
}else if(sonl[x][2]<l){
sonl[x][3] = sonl[x][2];
sonlc[x][3] = sonlc[x][2];
sonl[x][2] = l;
sonlc[x][2] = cl;
}else if(sonl[x][2]==l){
sonlc[x][2] += cl;
}else if(sonl[x][3]<l){
sonl[x][3] = l;
sonlc[x][3] = cl;
}else sonlc[x][3] += cl;
}
void dfs1(int x){
maxn[x][0] = a[x].b;
cnt[x][0] = 1;
sonl[x][0] = a[x].l;
sonlc[x][0] = 1;
for(int i:v[x]){
dfs1(i);
modify(x,maxn[i][0],cnt[i][0]);
modify(x,maxn[i][1],cnt[i][1]);
modify(x,maxn[i][2],cnt[i][2]);
modifyl(x,sonl[i][0],sonlc[i][0]);
modifyl(x,sonl[i][1],sonlc[i][1]);
}
}
void dfs2(int x){
if(x==6){
int k = 0;
}
if(x!=1){
int a = maxl[fath[x]][0];
int b = maxl[fath[x]][1];
int c;int d;int now=0;
if(sonl[fath[x]][now]==sonl[x][0]
&&sonlc[fath[x]][now]==sonlc[x][0]) now++;
if(sonl[fath[x]][now]==sonl[x][1]
&&sonlc[fath[x]][now]==sonlc[x][1]) now++;
c = sonl[fath[x]][now++];
if(sonl[fath[x]][now]==sonl[x][0]
&&sonlc[fath[x]][now]==sonlc[x][0]) now++;
if(sonl[fath[x]][now]==sonl[x][1]
&&sonlc[fath[x]][now]==sonlc[x][1]) now++;
d = sonl[fath[x]][now++];
set<int> st;
st.insert(a);
st.insert(b);
st.insert(c);
st.insert(d);
maxl[x][0] = *st.rbegin();
maxl[x][1] = (st.size()==1)?(-0x3f3f3f3f3f):*(++st.rbegin());
}
for(int i:v[x]){
dfs2(i);
}
}
signed main(){
read(n);read(q);
for(int i = 2;i<=n;i++){
read(fath[i]);
v[fath[i]].push_back(i);
}
for(int i = 1;i<=n;i++){
read(a[i].b);read(a[i].l);
}
dfs1(1);dfs2(1);
// for(int i = 1;i<=n;i++){
// cout << i << endl;
// cout << "maxn0:" << maxn[i][0] << " " << cnt[i][0] << endl;
// cout << "maxn1:" << maxn[i][1] << " " << cnt[i][1] << endl;
// cout << "maxn2:" << maxn[i][2] << " " << cnt[i][2] << endl;
// cout << "sonl0:" << sonl[i][0] << endl;
// cout << "sonl1:" << sonl[i][1] << endl;
// cout << "maxl:" << maxl[i] << endl;
// }
while(q--){
int s;
read(s);
if(s==6){
int l = 0;
}
int max1 = maxn[s][0];
int max2 = maxn[s][1];
int max3 = maxn[s][2];
// cout << max1 << " " << max2 << " " << max3 << endl;
if(!cnt[s][1]){if(cnt[s][0]==1||(maxl[s][0]==0)) write(0,endl);else write(max1,endl);}
else if(cnt[s][0]>1&&(maxl[s][0]!=0)) write(max1,endl);
else if(max2+maxl[s][0]<max1) write(max2+maxl[s][0],endl);
else if(max2+maxl[s][0]>max1) write(max1,endl);
else write(max((max3!=0)?(max3+maxl[s][0]):0,max2+maxl[s][1]),endl);
// else write(max2+maxl[s][1],endl);
// else write((max3!=0)?(max3+maxl[s][0]):0,endl);
}
return 0;
}
}
signed main(){
// freopen("soldier.in","r",stdin);
// freopen("soldier.out","w",stdout);
// ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int T = 1;
// gtx::read(T);
while(T--) gtx::main();
return 0;
}
/*
mem: 21MB/256MB
*/