#include <stdio.h>
#include <string.h>
#define N 100004
int tree[N];
char  mark[N];
int _find(int x)
{
    if(mark[x])
        return x;
    else return _find(tree[x]);
}

int main(void)
{
    int n, q, i;
   long long sum;

     while(scanf("%d%d",&n,&q)!=EOF)
    {
        if(!n&&!q)break;
        memset(mark, 0, sizeof(mark));
        for(i=1;i<=n;i++)
        {
            tree[i]=i;
        }
        mark[1] = tree[1] = 1;
        sum = 0;
        for(i = 2; i <= n; ++i)
            scanf("%d", &tree[i]);

         for(i=1;i<=q;i++)
        {
            char ch[20];
            scanf("%s",ch);
             int t;
            scanf("%d",&t);
            if(ch[0]=='Q')
            {
                sum += _find(t);
            }
            else
                mark[t] = 1;
        }
        printf("%lld\n", sum);
    }
}