#include<algorithm>
#include<iostream>
#include<string.h>
#include<sstream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
using namespace std;
const int INF=0x3f3f3f3f;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
const int maxn=100010;
int tree[maxn];
int Find(int x)
{
    if(tree[x]==x)
        return x;
    return Find(tree[x]);
}
int main()
{
    int n,m,id,i;
    char com[10];
    ll ans;

    while(scanf("%d%d",&n,&m),n||m)
    {
        tree[1]=1;
        ans=0;
        for(i=2;i<=n;i++)
            scanf("%d",&tree[i]);
        for(i=0;i<m;i++)
        {
            scanf("%s%d",com,&id);
            if(com[0]=='M')
                tree[id]=id;
            else
                ans+=Find(id);
        }
        printf("%lld\n",ans);
    }
    return 0;
}