#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;

int n, q;
vector<int> root;
vector< vector<int> > edge;

void update(int p, int v) {
	if(p <= 0 || n < p) return;

	root[p] = v;
	for(int i=0; i<edge[p].size(); i++) {
		if( root[edge[p][i]] == edge[p][i] ) {
			continue;
		} else {
			update(edge[p][i], v);
		}
	}
}

int main() {
	while(cin >> n >> q, n||q) {
		root.clear();
		edge.clear();
		root.resize(n+1);
		edge.resize(n+1);
		for(int i=2; i<=n; i++) {
			int p;
			cin >> p;
			root[i] = 1;
			edge[p].push_back(i);
		}
		root[1] = 1;
		ll sum = 0;
		rep(i, q) {
			char c;
			int v;
			cin >> c >> v;
			if(c == 'Q') {
				sum += root[v];
			} else if(c == 'M') {
				update(v, v);
			}
		}
		cout << sum << endl;
	}
	return 0;
}