#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) {
	while (!vis[x])
		x = father[x];
	return 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();
		fill(vis, vis + MAXN, false);
		vis[1] = true;
		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
				vis[b] = true;
		}
		printf("%lld\n", res);
	}
	//system("pause");
	return 0;
}

