#include<bits/stdc++.h>
#define int long long
#define rg register
#define il inline
#define pii pair<int, int>
#define x first
#define y second
#define TT(T, Args) template<typename T, typename... Args>
#define up(i, a, b) for (rg int i = (a); i <= (b); i++)
#define down(i, a, b) for (rg int i = (a); i >= (b); i--)
#define rep(i, a) for (rg auto i : a)
using namespace std;
namespace xmpl_{
#define SIZE (1 << 24)
namespace Fast_read{
char buf[SIZE], *S, *T;
il char Getchar(){
if (S == T){
T = (S = buf) + fread(buf, 1, SIZE, stdin);
if (S == T) return '\n';
}
return *S++;
}
}
namespace Fast_write{
char buf[SIZE], *S = buf, *T = buf + SIZE;
il void flush(){
fwrite(buf, 1, S - buf, stdout);
S = buf;
}
il void Putchar(char c){
*S++ = c;
if (S == T) flush();
}
struct F{
~F(){
flush();
}
}fly;
#undef SIZE
}
#define gc Fast_read::Getchar
#define pc Fast_write::Putchar
il int fast_rd(){
int f = 1, x = 0;
char ch = gc();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = gc();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = gc();
}
return x * f;
}
il void fast_wt(int x){
if (x < 0){
pc('-');
x = -x;
}
if (x > 9) fast_wt(x / 10);
pc(x % 10 + 48);
}
il string fast_rds(){
string s = "";
char ch = gc();
while((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')){
s += ch;
ch = gc();
}
return s;
}
il void fast_wts(string s){
for (int i = 0; i < s.size(); i++) pc(s[i]);
}
il int rd(){
int f = 1, x = 0;
char ch = getchar();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
TT(T, Args) il void rd(T &x){
int f = 1;
x = 0;
char ch = getchar();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = getchar();
}
x *= f;
}
TT(T, Args) il void rd(T &x, Args &...args){
rd(x), rd(args...);
}
TT(T, Args) il void fast_rd(T &x){
int f = 1;
x = 0;
char ch = gc();
while(ch < '0' || ch > '9'){
if (ch == '-') f = -1;
ch = gc();
}
while(ch >= '0' && ch <= '9'){
x = x * 10 + ch - '0';
ch = gc();
}
x *= f;
}
TT(T, Args) il void fast_rd(T &x, Args &...args){
fast_rd(x), fast_rd(args...);
}
il void wt(int x){
if (x < 0){
putchar('-');
x = -x;
}
if (x > 9) wt(x / 10);
putchar(x % 10 + 48);
}
il string rds(){
string s = "";
char ch = getchar();
while((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')){
s += ch;
ch = getchar();
}
return s;
}
il void wts(string s){
for (int i = 0; i < s.size(); i++) putchar(s[i]);
}
il int max(int x, int y){
return (x > y ? x : y);
}
il int min(int a, int b){
return (a < b ? a : b);
}
il int max(int x, int y, int z){
return max(x, max(y, z));
}
il int min(int a, int b, int c){
return min(a, min(b, c));
}
il int qmul(int a, int b, int p){
int res = 0;
while(b){
if (b & 1) res = (res + a) % p;
a = (a + a) % p;
b >>= 1ll;
}
return res;
}
il int qpow(int a, int b, int p){
int res = 1;
while(b){
if (b & 1) res = qmul(res, a, p);
a = qmul(a, a, p);
b >>= 1ll;
}
return res;
}
const int Q = 1e6 + 5;
int fac[Q] = {0}, inv[Q] = {0}, finv[Q] = {0};
il void init(int n, int p){
fac[0] = inv[0] = finv[0] = fac[1] = inv[1] = finv[1] = 1;
for (int i = 2; i <= n; i++){
fac[i] = 1ll * fac[i - 1] * i % p;
inv[i] = (p - 1ll * p / i * inv[p % i] % p) % p;
finv[i] = 1ll * finv[i - 1] * inv[i] % p;
}
}
il int A(int n, int m, int p){
if (m > n || m < 0) return 0;
return 1ll * fac[n] * finv[n - m] % p;
}
il int C(int n, int m, int p){
if (m > n || m < 0) return 0;
return 1ll * fac[n] * finv[m] % p * finv[n - m] % p;
}
il int Lucas(int n, int m, int p){
if (!m) return 1;
return (1ll * C(n % p, m % p, p) * Lucas(n / p, m / p, p)) % p;
}
il int gcd(int a, int b){
if (!b) return a;
return gcd(b, a % b);
}
il int lcm(int a, int b){
return 1ll * a * b / gcd(a, b);
}
const int W = 1e5 + 5;
struct int64{
int d[W];
int64(){
memset(d, 0, sizeof(d));
d[0] = 1;
}
int64(int x){
int64();
int it = 0;
while(x){
d[++it] = x % 10;
x /= 10;
}
d[0] = it;
}
bool operator < (const int64 &x) const{
if (d[0] ^ x.d[0]) return d[0] < x.d[0];
int it = d[0];
while(d[it] == x.d[it] && it > 1) it--;
if (it >= 1) return d[it] < x.d[it];
else return 0;
}
int64 operator * (const int &x){
int64 ans;
int len;
ans.d[0] = d[0];
for (int i = 1; i <= d[0]; i++) ans.d[i] = d[i] * x;
for (int i = 1; i <= ans.d[0] || ans.d[i]; i++){
ans.d[i + 1] += ans.d[i] / 10;
ans.d[i] %= 10;
len = i + 1;
}
ans.d[0] = len;
if (!ans.d[len]) ans.d[0]--;
return ans;
}
int64 operator / (const int &x){
int64 ans;
ans.d[0] = d[0];
int res = 0;
for (int i = d[0]; i >= 1; i--){
res = res * 10 + d[i];
ans.d[i] = res / x;
res %= x;
}
while(!ans.d[ans.d[0]] && ans.d[0] > 1) ans.d[0]--;
return ans;
}
};
std::ostream &operator << (std::ostream &ans, const int64 &x){
for (int i = x.d[0]; i >= 1; i--) ans << x.d[i];
return ans;
}
const int p = 998244353;
struct Mint{
int x;
Mint(){};
Mint(int x) : x(x){}
friend std::istream &operator >> (std::istream &in, Mint &a){
return in >> a.x;
}
friend std::ostream &operator << (std::ostream &out, Mint a){
return out << a.x;
}
friend Mint operator + (Mint a, Mint b){
return (a.x + b.x + p) % p;
}
friend Mint operator - (Mint a, Mint b){
return (a.x - b.x + p) % p;
}
friend Mint operator * (Mint a, Mint b){
return 1ll * a.x * b.x % p;
}
friend Mint operator / (Mint a, Mint b){
return (a.x / b.x + p) % p;
}
friend Mint &operator += (Mint &a, Mint b){
return a = a + b;
}
friend Mint &operator -= (Mint &a, Mint b){
return a = a - b;
}
friend Mint &operator *= (Mint &a, Mint b){
return a = a * b;
}
friend Mint &operator /= (Mint &a, Mint b){
return a = a / b;
}
friend Mint &operator ++ (Mint &a){
return a += 1;
}
friend Mint &operator -- (Mint &a){
return a -= 1;
}
friend bool operator == (Mint a, Mint b){
return a.x == b.x;
}
friend bool operator != (Mint a, Mint b){
return !(a == b);
}
friend Mint operator ^ (Mint a, int b){
Mint ans = 1;
for (; b; b >>= 1, a *= a) if (b & 1) ans *= a;
return ans;
}
};
}
using namespace xmpl_;
using namespace std;
const int N = 3e6 + 5, M = 1e6 + 5, K = 2e6 + 5;
int n, q, fa[N], b[N], l[N], s;
int max1[N], max2[N], max3[N], imax1[N], imax2[N], omax1[N], omax2[N];
vector<int> g[N];
il void init(){
}
il void clear(){
}
il void dfs(int u){
if (!u) return ;
if (g[u].empty()){
max1[u] = b[u], imax1[u] = l[u];
return ;
}
vector<int> vec, vc;
vec.push_back(b[u]);
rep(v, g[u]){
dfs(v);
vec.push_back(max1[v]), vec.push_back(max2[v]), vec.push_back(max3[v]), vc.push_back(imax1[v]);
}
vc.push_back(l[u]);
sort(vec.begin(), vec.end(), greater<int>());
sort(vc.begin(), vc.end(), greater<int>());
max1[u] = vec[0], max2[u] = vec[1];
for (int i = 2; i < vec.size(); i++){
if (vec[i] != max2[u]){
max3[u] = vec[i];
break;
}
}
imax1[u] = vc[0];
for (int i = 1; i < vc.size(); i++){
if (vc[i] != imax1[u]){
imax2[u] = vc[i];
break;
}
}
}
il int dfs2(int u, int mx){
int ans = 0;
if (b[u] ^ mx) ans = mx;
rep(v, g[u]) ans = max(ans, dfs2(v, mx));
return ans;
}
il int calc1(int u){
if (omax1[u]) return omax1[u];
if (u == 1) return omax1[u] = 0;
int f = fa[u], ans = l[f];
rep(v, g[f]){
if (v == u) continue;
ans = max(ans, imax1[v]);
ans = max(ans, imax2[v]);
}
return omax1[u] = max(ans, calc1(f));
}
il int calc2(int u){
if (omax2[u]) return omax2[u];
if (u == 1) return omax2[u] = 0;
int f = fa[u];
vector<int> vec;
vec.push_back(l[f]);
rep(v, g[f]){
if (v == u) continue;
vec.push_back(imax1[v]);
vec.push_back(imax2[v]);
}
vec.push_back(omax1[f]);
vec.push_back(calc2(f));
sort(vec.begin(), vec.end(), greater<int>());
for (int i = 1; i < vec.size(); i++){
if (vec[i] != omax1[u]){
omax2[u] = vec[i];
break;
}
}
return omax2[u];
}
il void calc3(){
up(i, 1, n) calc1(i);
up(i, 1, n) calc2(i);
}
il void work(){
rd(n, q);
up(i, 2, n) fa[i] = rd(), g[fa[i]].push_back(i);
up(i, 1, n) rd(b[i], l[i]), max1[i] = max2[i] = max3[i] = -1, imax1[i] = imax2[i] = omax1[i] = omax2[2] = 0;
dfs(1), calc3();
// up(s, 1, n) cout << max1[s] << " " << max2[s] << " " << max3[s] << " " << omax1[s] << " " << omax2[s] << " " << imax1[s] << " " << imax2[s] << endl;
while(q--){
s = rd();
if (max2[s] == -1) wt(0);
else if (!omax1[s] && max1[s] == max2[s] && max1[s] == max3[s]) wt(dfs2(s, max1[s]));
else if (max2[s] + omax1[s] > max1[s]) wt(max1[s]);
else if (max2[s] + omax1[s] < max1[s]) wt(max2[s] + omax1[s]);
else if (max3[s] == -1){
if (omax2[s]) wt(max2[s] + omax2[s]);
else wt(0);
}
else{
//max2[s] + omax1[s] == max1[s]
int val = min(max1[s], max3[s] + omax1[s]);
if (omax2[s] + max2[s] > max1[s]) val = max(max1[s], val);
else if (omax2[s] + max2[s] < max1[s]) val = max(omax2[s] + max2[s], val);
// assert(omax2[s] + max2[s] > max1[s]);
wt(val);
// int v1 = max2[s] + omax2[s], v2 = max3[s] + omax1[s];
// wt(max(v1, v2));
}
wts("\n");
}
}
/*
10 1
1 1 2 2 3 3 4 4 9
1 7
1 6
1 1
0 1
1 1
1 1
1 1
9 1
2 1
0 1
4
8
-------------------
5 2
1 2 3 4
1 1
1 0
1 0
1 0
1 0
1
2
0
1
-------------------
30 30
1 2 3 4 5 6 7 8 9 10 10 10 10 10 15 16 10 10 12 10 20 18 14 10 10 15 19 27 25
1 0
1 1
1000000000 1
1000000000 5
999999998 3
999999990 2
999999985 3
999999984 8
999999976 0
999999950 6
24 19
59 8
35 10
31 12
54 8
4 1
29 3
40 20
46 17
22 0
2 10
74 11
53 4
60 6
9 19
70 16
78 14
73 20
17 8
59 10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
999999998
999999998
1000000000
999999999
999999995
999999989
999999985
999999981
999999958
86
0
74
0
51
74
24
0
53
66
42
0
0
0
0
29
0
37
0
0
0
*/
signed main(){
//#define file 114514
#ifdef file
freopen("soldier.in", "r", stdin);
freopen("soldier.out", "w", stdout);
#endif
// init();
int t = 1;
// t = rd();
while(t--){
// clear();
work();
// puts("");
}
return 0;
}