#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>

using namespace std;

const double EPS=(1e-10);
typedef long long ll;
typedef pair<int,int> pii;
bool EQ(double a,double b){
  return abs((a)-(b))<EPS;
}
void fast_stream(){
  std::ios_base::sync_with_stdio(0);
}

const int INF=1000000000;

class UnionFindTree{
public:
  // indexÌÌem[h( éWÌeð©Â¯½¢Æ«Í±±ð¼ÚQÆ¹¸Afindðg¤)
  vector<int> par;
  // indexðªÆ·éØÌN
  vector<int> rank;
  //  éWÌã\l
  vector<int> val;
  // ØÌÅål
  int treeSize;
public:
  UnionFindTree(int initTreeSize = 1000){
    // øÅ^¦çê½lðÅåi[Æ·éUnionFindTreeÌì¬
    treeSize = initTreeSize;
    init();
  }
  void init(){
    for(int i = 0; i < treeSize; i++){
      par.push_back(i);
      rank.push_back(0);
      val.push_back(-1);
    }
  }
  // ^¦çê½ªi[³êÄ¢éØÌ[gðTõ
  int find(int x){  
    if(par[x] == x)return x;
    else return par[x] = find(par[x]);
  }
  // aWðÆéB½¾µ±±ÅÍeWÌeÌt¯Ö¦ÍN±çÈ¢
  void unite(int x,int y,int a){
    x = find(x);
    y = find(y);
    if(x == y)return;
    if(rank[x] < rank[y])par[x] = y;
    else{
      par[y] = x;
      if(rank[y] == rank[x])rank[x]++;
    }
    // valÌ«·¦
    val[find(x)]=a;
  }
  bool same(int x,int y){
    return find(x) == find(y);
  }
    
};

typedef pair<char,int>  pci;
const int MAX_V=100001;
vector<int> G[MAX_V];
pci ods[MAX_V];
int N,Q;
bool mark[MAX_V];
int firstMark[MAX_V];
int pars[MAX_V];

// curMarkÍ»ÝÌm[hª®·éem[h
void dfs(int s,int curMark,UnionFindTree &uft){
  if(mark[s]){
    for(int i=0;i<G[s].size();i++){
      int to=G[s][i];
      dfs(to,s,uft);
    }
    int idx=uft.find(s);
    uft.val[idx]=s;
  }
  else{
    uft.unite(s,curMark,-1);
    for(int i=0;i<G[s].size();i++){
      int to=G[s][i];
      dfs(to,curMark,uft);
    }
  }
}

int main(){

  while(cin>>N>>Q&&(N|Q)){
    memset(mark,0,sizeof(mark));
    memset(firstMark,0,sizeof(firstMark));
    UnionFindTree uft(N);
    for(int i=0;i<N;i++)G[i].clear();
    for(int i=1;i<N;i++){
      int par;
      cin>>par;
      par--;
      G[par].push_back(i);
      pars[i]=par;
    }
    mark[0]=true;
    firstMark[0]++;
    // }[NðÂ¯Ä¨­
    for(int i=0;i<Q;i++){
      cin>>ods[i].first>>ods[i].second;
      ods[i].second--;
      if(ods[i].first=='M'){
	firstMark[ods[i].second]++;
	mark[ods[i].second]=true;
      }
    }
    // ÄAÉæèAeWðª·é
    dfs(0,-1,uft);
    ll res=0;
    // ªãANGðãë©çµÄ¢­
    for(int i=Q-1;i>=0;i--){
      if(ods[i].first=='Q'){
	int a=uft.find(ods[i].second);
	int b=uft.val[a];
	res+=b+1;
      }
      else{
	firstMark[ods[i].second]--;
	if(firstMark[ods[i].second]>0)continue;
	// em[hÌ®·éØÆ
	int a=uft.val[uft.find(pars[ods[i].second])];
	uft.unite(ods[i].second,pars[ods[i].second],a);
      }
    }
    cout<<res<<endl;
  }

  return 0;
}

Measured memory_bytes: 10000