#include <iostream>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<queue>
#include<vector>
#define oo 0x3f3f3f33f
using namespace std;
int n, m, vis[100010];
int pre[100010];
int Quary(int x)
{
    if(vis[x]==1)
        return x;
    if(vis[pre[x]]==1)
        return pre[x];
    return Quary(pre[x]);
}
int main()
{
    int i;
    while(scanf("%d%d", &n, &m), n+m)
    {
        memset(vis, 0, sizeof(vis));
        char str[6];
        long long ans = 0;
        int root, v;
        vis[1]=1;
        pre[1]=1;
        for(i=2; i<=n; i++)
        {
            scanf("%d", &root);
            pre[i]=root;
        }
        for(i=0; i<m; i++)
        {
            scanf("%s%d", str, &v);
            if(str[0]=='M')
                vis[v]=1;
            else
                ans+=Quary(v);
        }
        printf("%lld\n", ans);
    }
    return 0;
}