#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pp = pair<int, int>;
using ld = long double;

template <typename T>
istream &operator>>(istream &s, vector<T> &a)
{
    for (T &el : a)
    {
        s >> el;
    }
    return s;
}

template <typename T>
ostream &operator<<(ostream &s, vector<T> &a)
{
    for (T el : a)
    {
        s << el << ' ';
    }
    s << '\n';
    return s;
}

void solve()
{
    int n, q;
    cin >> n >> q;
    vector<int> p(n, -1), s(n), belong(n, -1);
    vector<vector<int>> graph(n);
    for (int i = 1; i < n; i++)
    {
        cin >> p[i];
        p[i]--;
        graph[p[i]].push_back(i);
        if (p[i] == 0)
        {
            belong[i] = i;
        }
        else
        {
            belong[i] = belong[p[i]];
        }
    }
    cin >> s;
    vector<int> order;
    set<pp> choice;
    choice.emplace(s[0], 0);
    while (!choice.empty())
    {
        int v = prev(choice.end())->second;
        choice.erase(prev(choice.end()));
        order.push_back(v);
        for (int to : graph[v])
        {
            choice.emplace(s[to], to);
        }
    }
    vector<int> ans(n);
    vector<int> cnt(n);
    for (int i = 0; i < n; i++)
    {
        int v = order[i];
        if (v == 0)
        {
            ans[v] = 0;
            continue;
        }
        if (choice.find(make_pair(cnt[belong[v]], belong[v])) != choice.end())
        {
            choice.erase(make_pair(cnt[belong[v]], belong[v]));
        }
        cnt[belong[v]]++;
        choice.insert(make_pair(cnt[belong[v]], belong[v]));
        auto it = prev(choice.end());
        while (true)
        {
            if (it->second != belong[v])
            {
                ans[v] -= it->first;
                break;
            }
            if (it == choice.begin())
            {
                break;
            }
            it = prev(it);
        }
        ans[v] += i;
    }
    // cout << order;
    while (q--)
    {
        int v;
        cin >> v;
        v--;
        cout << ans[v] << ' ';
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
}