#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;
const int MAX_N = 100000 + 10;
int N, Q;
int P[MAX_N];
int vis[MAX_N];

void build(int N) {
    for (int i = 0; i <= N; i++)
        P[i] = i;
}

int find(int x) {
    if (vis[P[x]])
        return P[x];
    else
        return find(P[x]);
}

void Unite(int parent, int child) {
    P[child] = parent;
}

int main() {
    while (~scanf("%d %d", &N, &Q) && (N || Q)) {
        memset(vis, 0, sizeof(vis));
        vis[1] = 1;
        build(N);
        int x;
        for (int i = 2; i <= N; i++) {
            scanf("%d", &x);
            Unite(x, i);
        }
        char s;
        long long sum = 0;
        getchar();
        for (int i = 0; i < Q; i++) {
            scanf("%c %d", &s, &x);
            getchar();
            if (s == 'M')
                vis[x] = 1;
            else
                sum += find(x);
        }
        printf("%lld\n", sum);
    }
    return 0;
}