#include<bits/stdc++.h>
#define Fi first
#define Se second
#define bug(x) cerr<<#x<<'='<<x<<' '
#define debug(x) cerr<<#x<<'='<<x<<endl
#define FOR(a,b,c) for(int a=(b),a##_end=(c);a<=a##_end;++a)
#define ROF(a,b,c) for(int a=(b),a##_end=(c);a>=a##_end;--a)
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f,N=1e5+10;
template<class T>inline bool chkmin(T& A,T B){return B<A?A=B,1:0;}
template<class T>inline bool chkmax(T& A,T B){return A<B?A=B,1:0;}
int n,m,op[N],u[N],fa[N],vis[N];
int par[N];
int Find(int x){
	if(par[x]==x)return x;
	return par[x]=Find(par[x]);
}
int main(){
	char s[10];
	while(scanf("%d%d",&n,&m),n||m){
		ll ans=0;
		memset(vis,0,sizeof(vis));
		memset(par,0,sizeof(par));
		fa[1]=1;
		FOR(i,2,n)scanf("%d",&fa[i]);
		FOR(i,1,m){
			scanf("%s%d",s+1,&u[i]);
			if(s[1]=='M')op[i]=1,par[u[i]]=u[i],++vis[u[i]];
			else op[i]=2;
		}
		FOR(i,1,n)if(!par[i])par[i]=fa[i];
		ROF(i,m,1)
			if(op[i]==1){
				if(!(--vis[u[i]]))par[u[i]]=Find(fa[u[i]]);
			}
			else ans+=Find(u[i]);
		printf("%lld\n",ans);
	}
	return 0;
}
