#include <bits/stdc++.h>
using namespace std;
struct unionfind{
  vector<int> p;
  unionfind(int n){
    p = vector<int>(n, -1);
  }
  int root(int x){
    if (p[x] == -1){
      return x;
    } else {
      p[x] = root(p[x]);
      return p[x];
    }
  }
  void unite(int x, int y){
    x = root(x);
    y = root(y);
    p[x] = y;
  }
};
int main(){
  while (1){
    int N, Q;
    cin >> N >> Q;
    if (N == 0 && Q == 0){
      break;
    }
    vector<int> p(N, -1);
    for (int i = 1; i < N; i++){
      cin >> p[i];
      p[i]--;
    }
    vector<pair<char, int>> query(Q);
    vector<int> m(N, 0);
    m[0]++;
    for (int i = 0; i < Q; i++){
      char c;
      int v;
      cin >> c >> v;
      v--;
      query[i] = make_pair(c, v);
      if (c == 'M'){
        m[v]++;
      }
    }
    unionfind UF(N);
    for (int i = 1; i < N; i++){
      if (m[i] == 0){
        UF.unite(i, p[i]);
      }
    }
    long long ans = 0;
    for (int i = Q - 1; i >= 0; i--){
      char c = query[i].first;
      int v = query[i].second;
      if (c == 'Q'){
        ans += UF.root(v) + 1;
      } else {
        m[v]--;
        if (m[v] == 0){
          UF.unite(v, p[v]);
        }
      }
    }
    cout << ans << endl;
  }
}
