#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) REP(i, 0, (n))
#define REP(i, a, n) for(int i=(a); i<(n); i++)

int parents[100005];
bool marked[100005];

int dfs(int node) { return marked[node]? node:dfs(parents[node]); }

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int n, q, node; char c;
    while(cin>>n>>q, n+q) {
        REP(i, 2, n+1) cin >> parents[i];
        memset(marked, false, sizeof(marked));
        marked[1] = true;
        long long ans = 0;
        rep(i, q) {
            cin >> c >> node;
            if(c == 'M') marked[node] = true;
            else ans += dfs(node);
        }
        cout << ans << endl;
    }
}

