#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;

class union_find {
private:
	vector<int> uf;

public:
	union_find(int n) {
		uf.resize(n, -1);
	}

	inline int find(int x) {
		return uf[x] < 0 ? x : uf[x] = find(uf[x]);
	}

	inline void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if(x == y)
			return;
		
		if(uf[x] > uf[y])
			swap(x, y);
		
		else if(uf[x] == uf[y])
			--uf[x];
		
		uf[y] = x;
	}

	inline bool same(int x, int y) {
		return find(x) == find(y);
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	for(int n, q; cin >> n >> q, n | q;) {
		vector<int> parent(n, -1);
		for(int i = 1; i < n; ++i) {
			int input;
			cin >> input;
			parent[i] = --input;
		}

		stack<int> mark, query;
		vector<bool> is_mark(q, false);
		vector<bool> is_root(n, false);
		is_root[0] = true;

		for(int i = 0; i < q; ++i) {
			char ope;
			int v;
			cin >> ope >> v;
			if(ope == 'Q')
				query.push(v);
			else {
				is_mark[i] = true;
				is_root[v] = true;
				mark.push(v);
			}
		}

		union_find uf(n);
		for(int i = 0; i < n; ++i)
			if(!is_root[i])
				uf.unite(i, parent[i]);

		int ans = 0;
		for(int i = q - 1; i >= 0; --i) {
			if(is_mark[i]) {
				int v = mark.top();
				mark.pop();
				uf.unite(v, parent[v]);
			}
			else {
				int v = query.top();
				query.pop();
				ans += uf.find(v) + 1;
			}
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}