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

#include <sstream>

#include <cstdio>

#include <algorithm>

#include <cstring>

#include <iomanip>

#include <utility>

#include <string>

#include <cmath>

#include <vector>

#include <bitset>

#include <stack>

#include <queue>

#include <deque>

#include <map>

#include <set>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

const int dir[9][2] = { 0, 1, 0, -1, 1, 0, -1, 0, 1, 1, 1, -1, -1, 1, -1, -1, 0, 0 };

const ll  ll_inf = 0x7fffffff;

const double PI=acos(-1.0);

template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}

const int inf = 0x3f3f3f;

const int mod = (int) 998244353;

const int Max = (int) 1e5 + 22;

stringstream ss;



/**********************************************Head-----Template****************************************/

bool Finish_read;

template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}

template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}

template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}

template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}



/********************************Head----Temlate**********************************************/



//tools:

//priority_queue <int, vector<int>, greater<int> > Q;

//ios::sync_with_stdio(false);

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

//ss<<int; ss>>str;



int n, q;

int Fa[Max];

int value[Max];



void Init() {

	Fa[1] = 0;

	memset(value, 0, sizeof(value));

	value[1] = 1;

}



int main() {

	while (~scanf("%d %d", &n, &q) && n+q) {

		Init();

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

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

		}



		ll ans = 0;

		int x;

		char ch[10];

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

			scanf("%s %d", ch, &x);

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

				while (x) {

					if (value[x]) {

						ans += (ll)x;

						break;

					}

					x = Fa[x];

				}

			}

			else {

				value[x] = 1;

			}

		}



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

	}

	return 0;

}




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

#include<iostream>

#include<algorithm>

#include<cmath>



using namespace std;

const int maxn = 5e5+5;

int n,m;

int far[maxn];

int Rank[maxn];

int find(int x){

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

	else return find(far[x]);

}

void unite(int x,int y){

	x = find(x);

	y = find(y);

	if(x == y) return;

	

	if(Rank[x] < Rank[y]) far[x] = y;

	else

	{

		far[y] = x;

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

	}

}

bool check(int x,int y){

	return find(x) == find(y);

}

void init(int n){

	for(int i = 0;i <= n;i++)

	{

		far[i] = i;

		//Rank[i] = 0;

	}

}



int main()

{

	while(~scanf("%d %d",&n,&m) &&(m||n))

	{

		init(n);

		int a;

		long long ans = 0;

		for(int i = 2;i <= n;i++)

		{

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

		}

		char c[3];

		for(int i = 0;i <m;i++)

		{

			scanf("%s %d",c,&a);

			if(c[0] == 'M') far[a] = a;

			else  

			{

				ans += find(a);

			}

		}

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

	}

	

	return 0;

}