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

typedef long long lli;

struct Tree {
    vector<int> par;
    vector<int> mark;
    Tree(int n) : par(n, -1), mark(n, 0) { }

    void unmark(int k) {
        mark[k]--;
    }

    int query(int k) {
        if(mark[k]) return k;
        return par[k] = query(par[k]);
    }
};

int main() {
    for(int N, Q; cin >> N >> Q, N + Q > 0; ) {
        Tree tree(N);
        tree.mark[0]++;
        for(int i = 0; i < N - 1; i++) {
            int p; cin >> p; p--;
            tree.par[i + 1] = p;
        }
        vector<int> type;
        vector<int> node;
        for(int i = 0; i < Q; i++) {
            char t; int n; cin >> t >> n; n--;
            type.push_back(t == 'Q');
            node.push_back(n);
            if(t == 'M') tree.mark[n]++;
        }
        reverse(type.begin(), type.end());
        reverse(node.begin(), node.end());
        lli res = 0;
        for(int i = 0; i < Q; i++) {
            if(type[i]) {
                res += tree.query(node[i]) + 1;
            }
            else {
                tree.unmark(node[i]);
            }
        }
        cout << res << endl;
    }
}