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

typedef long long ll;

const int MAX_N = 100000;
int p[MAX_N + 10];
int n, t;
ll ans;

int find(int a) {
    return p[a] == a ? a : find(p[a]);
}

void unite(int a, int b) {
    int pa = find(a), pb = find(b);
    if(pa != pb) p[pa] = pb;
}

int main() {
    while(scanf("%d%d", &n, &t) && n && t) {
        for(int i = 1; i < n; i++) {
            scanf("%d", &p[i+1]);
        }
        p[1] = 1;
        char op[3];
        int id;
        ans = 0;
        while(t--) {
            scanf("%s%d", op, &id);
            if(op[0] == 'M') {
                p[id] = id;
            } else {
                ans += (ll)find(id);
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}
