#include<stdio.h>
#include <stdlib.h>

#define MAX_N 100002
int par[MAX_N];
int rank[MAX_N];
int n,o,temp[MAX_N];

struct  node {
   int parent,mark;
} ;
struct node p[MAX_N];


void node_init(int n){
  int i;
  for (i = 0; i <= n; ++i) {
    p[i].parent = temp[i];
    if (i == 1) p[i].mark = 1;
    else p[i].mark = 0;
  }
}

//Union Find Tree?????????????????????
//????????¶?????§??????????????????????????§???
//?????¨??????????´???????????????????
void init(int n){
  int i;
  for(i=0;i<n;i++){
    par[i] = i;
    rank[i] = 0;
  }
}


//x?????????????´?????±??????????????????£??¨????????????
int find(int x){
  if(par[x]==x){
    return x;
  }else {
    return par[x] = find(par[x]);
  }
}


//x,y????±?????????????????????¨??????
void unite(int x,int y){
  x =find(x);
  y =find(y);
  if(x==y){
    return ;
  }

    par[y] = x;

}


//x,y????±?????????????????????????????????????
int same(int x,int y){
  return find(x)==find(y);
}

void Tree_print(){
  int i;
  for (i = 1 ;i <= n;i++) printf("%d",par[i]);
  printf("\n");
}

int main() {
  int i,ob,current;
  long long int ans;
  char str[16],op;

  while(1){
    ans = 0;
    scanf("%d %d",&n,&o);
    //printf("%d %d\n",n,o);
    if( n == 0 && o == 0) break;
    init(n+1);

    for (i = 2; i <= n; ++i) {
      scanf("%d",&temp[i]);
      //printf("%d get\n",i);
    }

    node_init(n);

    for (i = n; i > 1 ; --i) {
      unite(p[i].parent,i);
      //Tree_print();
    }
    //Tree_print();

    for ( i= 0;  i < o; ++i) {
      if(i ==0 )getchar();
      fgets(str,16,stdin);
      sscanf(str,"%c %d",&op,&ob);
      //printf("%c %d\n",op,ob);
      if (op == 'M'){
        p[ob].mark = 1;
      }
      else{
        if (p[ob].mark == 1) ans += ob;
        else{
          current = par[ob];
          //printf("%d\n",current);
          while(p[current].mark != 1){
            current =par[current];
          }
          ans+= current;

        }
      }
    }
    printf("%d\n",ans);
  }

  return 0;
}