#include<iostream>
#include<algorithm>
#include<vector>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define MAX 10000000
using namespace std;
int par[MAX];
int N,Q;

void init()
{
  rep(i,MAX)par[i] = i;
}

int find(int x)
{
  if(x == par[x])return x;
  return find(par[x]);
}

bool unit(int x,int y)
{
  x = find(x);
  y = find(y);
  if(x != y)par[y] = x;
}

bool same(int x,int y)
{
  return find(x) == find(y);
}

int main()
{
  while(cin >> N >> Q,N|Q)
    {
      init();
      REP(i,1,N)
	{
	  int variable;
	  cin >> variable;
	  variable--;
	  par[i] = variable;
	}

      long long cost = 0;
      rep(i,Q)
	{
	  char Query;
	  int v;
	  cin >> Query >> v;
	  v--;
	  if(Query == 'Q')
	    {
	      cost += find(v)+1;
	    }
	  else 
	    {
	      par[v] = v;
	    }
	}
      cout << cost << endl;
    }
  return 0;
}

 