#include <algorithm>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n, -1) {}
	int find(int x) { return (v[x] < 0) ? x : (v[x] = find(v[x])); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x != y) {
			// if (-v[x] < -v[y]) swap(x, y);
			v[x] += v[y]; v[y] = x;
		}
	}
	int size(int x) { return -v[find(x)]; }
	bool same(int x, int y) { return find(x) == find(y); }
};

int par[100001], a[100001];
char c[100000]; int v[100000];

int main() {
	for (;;) {
		int N, Q;
		scanf("%d%d", &N, &Q);
		if (N == 0 && Q == 0)
			break;
		for (int _v = 2; _v <= N; _v++)
			scanf("%d", &par[_v]);
		fill(a, a + 100001, 0);
		for (int i = 0; i < Q; i++) {
			char s[2]; int _v;
			scanf("%s%d", s, &_v);
			c[i] = s[0];
			v[i] = _v;
			if (s[0] == 'M')
				a[_v]++;
		}
		UnionFind uf(N + 1);
		for (int _v = 2; _v <= N; _v++)
			if (a[_v] == 0)
				uf.unite(par[_v], _v);
		long long ans = 0;
		for (int i = Q - 1; i >= 0; i--) {
			int _v = v[i];
			if (c[i] == 'M') {
				if (--a[_v] == 0 && _v != 1)
					uf.unite(par[_v], _v);
			}
			else if (c[i] == 'Q')
				ans += uf.find(_v);
		}
		printf("%lld\n", ans);
	}
}