#include <cstdio>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#define min(a,b)    (((a) < (b)) ? (a) : (b))
#define max(a,b)    (((a) > (b)) ? (a) : (b))
#define abs(x)    ((x) < 0 ? -(x) : (x))
#define INF 0x3f3f3f3f
#define delta 0.85
#define eps 1e-3
#define PI 3.14159265358979323846
#define MAX_N 100005
using namespace std;
typedef long long ll;
int N, Q;
int par[MAX_N], mark[MAX_N];
int qt[MAX_N], qv[MAX_N];

int find(int t, int x){
	return mark[x] < t ? x : par[x] = find(t, par[x]);
}

int main(){
	while(~scanf("%d%d", &N, &Q) && N){
		for(int i = 2; i <= N; i++){
			scanf("%d", par + i);
			mark[i] = INF;
		}
		int cnt = 0;
		for(int i = 1; i <= Q; i++){
			int x;
			char c;
			scanf(" %c%d", &c, &x);
			if(c == 'M'){
				mark[x] = min(mark[x], i);
			}
			else{
				qt[cnt] = i, qv[cnt] = x;
				++cnt;
			}
		}
		ll sum = 0;
		for(int i = cnt - 1; i >=0 ; i--){
			sum += find(qt[i], qv[i]);
		}
		printf("%lld\n", sum);
	}
	return 0;
}
