// Slower C++ solution:
/* 

 author:hdsdogge 

 begin: 

 end: 

 cost: 

 */

#include<iostream>

#include<string>

#include<queue>

#include<map>

#include<stack>

#include<algorithm>

#include<cmath>

#include<cstdio>

#include<cstring>

#include<vector>

#include<bitset>

#include<cstdlib>

#include<list>

#include <sstream>

#include<ctype.h>

using namespace std;

const int maxn=1000000+10;

typedef pair<int,int> P;

typedef long long ll;

const double PI = acos(-1.0);

const double eps = 1e-6;

const int INF = 1000000000;

int T,n,m;

int par[maxn];

int vis[maxn];

int main() {

   // freopen("test","r",stdin);

   // freopen("out","w",stdout);

    std::ios::sync_with_stdio(false);

    std::cin.tie(0);

    while(cin>>n>>m&&(n+m)){

        memset(vis,0, sizeof(vis));

        par[1]=1;

        vis[1]=1;

        ll ans=0;

        for(int i=2;i<=n;i++){

            int x;

            cin>>x;

            par[i]=x;

        }

        for(int i=0;i<m;i++){

            char c;

            int x;

            cin>>c>>x;

            if(c=='Q'){

                while(vis[x]==0){

                    x=par[x];

                }

                ans+=x;

            }

            else if(c=='M'){

               vis[x]=1;

            }

        }

        cout<<ans<<endl;

    }

    return 0;

} 






// Faster C++ solution for the same problem (measured speedup: 3.638030489946572x):
#include <iostream>

#include <sstream>

#include <cstdio>

#include <algorithm>

#include <cstring>

#include <iomanip>

#include <utility>

#include <string>

#include <cmath>

#include <vector>

#include <bitset>

#include <stack>

#include <queue>

#include <deque>

#include <map>

#include <set>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

const int dir[9][2] = { 0, 1, 0, -1, 1, 0, -1, 0, 1, 1, 1, -1, -1, 1, -1, -1, 0, 0 };

const ll  ll_inf = 0x7fffffff;

const double PI=acos(-1.0);

template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}

const int inf = 0x3f3f3f;

const int mod = (int) 998244353;

const int Max = (int) 1e5 + 22;

stringstream ss;



/**********************************************Head-----Template****************************************/

bool Finish_read;

template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}

template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}

template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}

template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}



/********************************Head----Temlate**********************************************/



//tools:

//priority_queue <int, vector<int>, greater<int> > Q;

//ios::sync_with_stdio(false);

//freopen("input.txt", "r", stdin);

//ss<<int; ss>>str;



int n, q;

int Fa[Max];

int value[Max];



void Init() {

	Fa[1] = 0;

	memset(value, 0, sizeof(value));

	value[1] = 1;

}



int main() {

	while (~scanf("%d %d", &n, &q) && n+q) {

		Init();

		for (int i = 2; i <= n; ++i) {

			scanf("%d", &Fa[i]);

		}



		ll ans = 0;

		int x;

		char ch[10];

		for (int i = 0; i < q; ++i) {

			scanf("%s %d", ch, &x);

			if (ch[0] == 'Q') {

				while (x) {

					if (value[x]) {

						ans += (ll)x;

						break;

					}

					x = Fa[x];

				}

			}

			else {

				value[x] = 1;

			}

		}



		printf("%lld\n", ans);

	}

	return 0;

}