#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long fa[100005],ans,a;
int n,q,i;
bool r[100005];
char c;
long long find(long long x)
{
	if(r[x]==1)
		return x;
	return find(fa[x]);
}
int main()
{
	fa[1]=1;
	r[1]=1;
	while(1)
	{
		scanf("%d %d",&n,&q);
		if(n==0||q==0)
			return 0;
		ans=0;
		for(i=2;i<=n;i++)
			r[i]=0;
		for(i=2;i<=n;i++)
			scanf("%lld",&fa[i]);
		for(i=1;i<=q;i++)
		{
			scanf("\n%c %lld",&c,&a);
			if(c=='M')
				r[a]=1;
			if(c=='Q')
				ans=ans+find(a);
		}
		printf("%lld\n",ans);
	}
}