 #include<iostream>

/**************
 * @Math
 **************/
#include<cmath>
#include<algorithm>

/**************
 * @String
 **************/

#include<cstring>
#include<string>
#include<string.h>

/**************
 * @container
 **************/
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;
#define maxSize 100001
bool mark[maxSize];
int p[maxSize] , f[maxSize];
vector<int> v[maxSize];
pair<char, int> query[maxSize];
void init()
{
	for (int i = 0; i < maxSize; ++i)
	{
		 p[i] = i;
	}
}
 
int parent(int i)
{
	if(p[i] == i) return i;
	return p[i] = parent(p[i]);
 }

void u(int a, int b) 
{
	p[parent(a)] =  parent(b);
	return ;
}

void Bfs() 
{
	queue<int> que;
	que.push (1);
	p[1] = 1;
	while(!que.empty())
	{
		int cur  = que.front();
		que.pop();
		for (int i = 0; i < v[cur].size(); ++i)
		{
			if(mark[v[cur][i]] == true) {p[v[cur][i]] = v[cur][i];}
			else  p[v[cur][i]] = p[cur];		 
			que.push(v[cur][i]);
			// cout << v[cur][i] << endl;
		}	
	}
	return ;
}

int main( )
{
	int  a, N, Q;	
	while ( cin >>  N >> Q  && N && Q) {
		memset(mark,0,sizeof(mark));
		for (int i = 1; i <= N; ++i)
		{
			 if(i == 1) { f[1] = 1; continue;}
			 cin >> a;
			 v[a].push_back(i);
			 f[i] = a;
		}
		mark[1] = true;
		for (int i = 1; i <= Q; ++i)
		{
			  cin >> query[i].first  >> query[i].second ;
			  if(query[i].first == 'M') mark[query[i].second] = true;
		}
		 
		Bfs();
		 
		stack<int> ans ;
		for (int i = Q; i >= 1; --i)
		{
			 if(query[i].first == 'Q') { ans.push(parent(query[i].second)) ; continue;}
			 mark[query[i].second] = false;
			 p[query[i].second] = p[f[query[i].second]];
			 for (int i = 0; i < v[query[i].second].size(); ++i) 
			 {
			 	p[v[query[i].second][i]] = p[f[query[i].second]];
			 }
		}
		int num =0;
		while(!ans.empty()) {
	 		num += ans.top();
	 	    	ans.pop();
		}
		cout << num << endl;
	}
	return 0;
}