#include <bits/stdc++.h>

using namespace std;

const int maxn = 300005;
const int maxlog = 19;
const int INF = 1e9;

int segTree[4*maxn];
int p[4*maxn];

void push(int l,int r,int indV)
{
    if(l == r)
    {
        segTree[indV] += p[indV];
        p[indV] = 0;
        return ;
    }
    p[indV*2+1] += p[indV];
    p[indV*2+2] += p[indV];
    segTree[indV] += p[indV];
    p[indV] = 0;
    return ;
}

void modify(int lx,int rx,int x,int l,int r,int indV)
{
    push(l,r,indV);
    if(l > rx || r < lx)
        return ;
    else if(l >= lx && r <= rx)
    {
        p[indV] += x;
        push(l,r,indV);
        return ;
    }
    int m =(l+r)/2;
    modify(lx,rx,x,l,m,indV*2+1);
    modify(lx,rx,x,m+1,r,indV*2+2);
    segTree[indV] = max(segTree[indV*2+1],segTree[indV*2+2]);
}

vector<int> g[maxn];
int tin[maxn],tout[maxn];
int par[maxn];
int times = 0;
int head[maxn];
int sz[maxn];
int dep[maxn];
int s[maxn];
int n;


void dfs_sz(int v,int p,int d)
{
    par[v] = p;
    dep[v] = d;
    sz[v] = 1;
    for(int i =0;i < g[v].size();++i)
    {
        if(g[v][i] != p)
        {
            dfs_sz(g[v][i],v,d+1);
            sz[v] += sz[g[v][i]];
            if(sz[g[v][i]] > sz[g[v][0]])
                swap(g[v][i],g[v][0]);
        }
    }
    return ;
}
void hld(int v,int p,int th)
{
    head[v] = th;
    tin[v] = times++;
    for(auto u:g[v])
    {
        if(u != p)
            hld(u,v,(u == g[v][0] ? th : u));
    }
    tout[v] = times;
    return ;
}
bool isP(int u,int v)
{
    return (tin[u] <= tin[v] && tin[v] <= tout[u]);
}
void modifyx(int i,int x)
{
    int act = 0;
    while(i != -1)
    {
        act++;
        modify(tin[head[i]],tin[i],x,0,n-1,0);
        i = par[head[i]];
    }
    assert(act < maxlog * 2);
}
int getp()
{
    return segTree[0];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int q;
    cin >> n >> q;
    for(int j =1;j < n;++j)
    {
        int p;
        cin >> p;
        g[p-1].push_back(j);
    }
    dfs_sz(0,-1,0);
    hld(0,-1,0);
    for(int j = 0;j < n;++j)
    {
        cin >> s[j];
    }
    int ans[n];
    set<pair<int,int>> tv;
    tv.insert({-s[0],0});
    vector<int> sp;
    while(tv.size())
    {
        int v = (*tv.begin()).second;
        tv.erase(tv.begin());
        sp.push_back(v);
        for(auto u:g[v])
        {
            tv.insert({-s[u],u});
        }
    }
    for(int j = 0;j < sp.size();++j)
    {
        modifyx(sp[j],-INF);
        ans[sp[j]] = j-max(0,getp());
        modifyx(sp[j],INF+1);
    }
    while(q--)
    {
        int v;
        cin >> v;
        v--;
        cout << ans[v] << ' ';
    }
    return 0;

}
