// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <vector>

#include <queue>

#include <stack>

using namespace std;

 

//思路：并?集 + ? + ?列 （??取出方式） 



int parent[100016];

int height[100016];



//并?集 

void init(int n)

{

	for(int i = 1; i <= n; i++){

		parent[i] = i;

		height[i] = 0;

	}

}

 

int find(int x)

{

	if(parent[x] == x)  return x;

	else  return parent[x] = find(parent[x]);

}

 

void unite(int x, int y)

{

	x = find(x);

	y = find(y);

	if(x == y)  return;

	if(height[x] < height[y])  parent[x] = y;

	else{

		parent[y] = x;

		if (height[x] == height[y])  height[x]++;

	}

}

 

//用来描述原始? 

vector<int> children[100016];

int parent_tree[100016];

bool marked[100016];

int ancestor[100016];

// ?条指令被拆分? 操作 + 目?

stack<char> operation;

stack<int>  target;

 

void bfs(int index, int the_ancestor)

{

	queue<int> q_index;

	queue<int> q_ancestor;

	q_index.push(index);

	q_ancestor.push(the_ancestor);

	while (!q_index.empty())

	{

		the_ancestor = q_ancestor.front(); 

		q_ancestor.pop();

		index = q_index.front(); 

		q_index.pop();

		if(marked[index] == true)  the_ancestor = index;  //如果?点自身被??，?它的染色祖先是自己，它的自己不??的儿子的最近染色祖先是它

		ancestor[index] = the_ancestor;  //??index的最近染色祖先 

		for(vector<int>::iterator it = children[index].begin(); it != children[index].end(); it++){  //将index的儿子加入?列 

			q_index.push(*it);

			q_ancestor.push(the_ancestor);

		}

	}

}

 

int main()

{

 

	int N, Q;

	while(scanf("%d %d", &N, &Q) && (N || Q)){

		for(int i = 1; i <= N; i++){

			children[i].clear();

			marked[i] = false;

		}

		marked[1] = true;

		parent_tree[1] = 1;

		int p;

		for(int i = 2; i <= N; i++){

			scanf("%d", &p);

			parent_tree[i] = p;

			children[p].push_back(i);

		}

		getchar(); 

		for(int i = 0; i < Q; i++){

			char ch;

			int t;

			scanf("%c %d", &ch, &t);

			getchar();

			if(ch == 'M'){

				if(marked[t])  continue;  //不?存重?的 "M v"，防止之后重?反染色 

				else  marked[t] = true;

			}

			operation.push(ch);

			target.push(t);

		}

		bfs(1, 1);

		init(N);

		for(int i = 1; i <= N; i++){

			unite(i, ancestor[i]);

		}

		unsigned long long result = 0;

		while(!operation.empty()){  //从后往前取出操作

			char ch = operation.top(); 

			operation.pop();

			int t = target.top(); 

			target.pop();

			if(ch == 'Q')  result += ancestor[find(t)];  //?目index从1?始

			else{  //??点t反染色（取消染色），t的祖先??其父?点的祖先

				int p = ancestor[find(parent_tree[t])];

				unite(t, parent_tree[t]);

				ancestor[find(t)] = p;

			}

		}

		printf("%lld\n", result);

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.543264436811501x):
#include <iostream>

#include <string.h>

#include <vector>

#include <queue>

#include <functional>

#include <algorithm>

using namespace std;



const int MAXN = 100010;

const int MAXM = 100010;

const int INF = 0x3f3f3f3f;

typedef long long LL;

typedef pair<int, int> P;



int N, Q;

int father[MAXN];

bool vis[MAXN];



void Init() {

	for (int i = 0; i < MAXN; ++i) {

		father[i] = i;

	}

}

int Find(int x) {

	if (father[x] == x)

		return x;

	return Find(father[x]);

}



int main(int argc, char const *argv[]) {

#ifdef LOCAL

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);

#endif

	while (scanf("%d%d", &N, &Q) != EOF && !(N == 0 && Q == 0)) {

		int a, b;

		LL res = 0;

		char opt[5];

		Init();

		for (int i = 2; i <= N; ++i) {

			scanf("%d", &father[i]);

		}

		for (int i = 0; i < Q; ++i) {

			scanf("%s %d", opt, &b);

			if (opt[0] == 'Q') {

				res += Find(b);

			}

			else

				father[b] = b;

		}

		printf("%lld\n", res);

	}

	//system("pause");

	return 0;

}