#include <cstdio>

#define N 100005

typedef long long ll;

int parents[N];

int find(int x){
        if (x == parents[x]) return x;
        else return find(parents[x]);
}

int main(){
        int n, q;
        while(~scanf("%d %d", &n, &q)){
                if (n == 0 && q == 0) break;
                for (int i = 2; i <= n; i++){
                        scanf("%d", &parents[i]);
                }
                parents[1] = 1;
                ll sum = 0;
                char c;
                int x;
                for (int i = 0; i < q; i++){
                        getchar();
                        scanf("%c %d", &c, &x);
                        if (c == 'Q') sum += find(x);
                        else parents[x] = x;
                }
                printf("%lld\n", sum);
        }
        return 0;
}