#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX_N 100001
int par[MAX_N];
int rank[MAX_N];

struct operate{char op;int num;};

void init(int n){
	int i;
	for(i=0;i<n;i++){
		par[i] = i;
		rank[i] = 0;
	}
}

int M_find(int x,int mark[]){
	if(mark[x]==1){
		return x;
	}else{
		return M_find(par[x],mark);
	}
}

void make_tree(int x,int y){
	if(x==y){
		return ;
	}
	else par[x]=y;
}

int main(){
	int i,n,num_q,p_node;
	int mark[MAX_N];
	struct operate ope;
	long long int sum;

	while(1){
		scanf("%d %d",&n,&num_q);
		if(n==0)break;
		init(MAX_N);
		sum=0;

		for(i=2;i<=n;i++){
			mark[i]=0;
			scanf("%d",&p_node);
			make_tree(i,p_node);
		}
		getchar();
		mark[1]=1; i=0;
		for(i=0;i<num_q;i++){
			scanf("%c %d",&ope.op,&ope.num);
			getchar();
			if(ope.op=='Q')sum+=M_find(ope.num,mark);
			if(ope.op=='M')mark[ope.num]=1;
		}
		printf("%lld\n",sum);
	}
	return 0;
}