#include <stdio.h>
#include <string.h>

int tree[100012];
char  mark[100012];

int main(void)
{
    int n, q, t, i;
    char ch;
    unsigned long long sum;

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

        for(i = 0; i < q; ++i) {
            scanf(" %c%d", &ch, &t);

            if(ch == 'M')
                mark[t] = 1;
            else {
                for(; !mark[t]; t = tree[t])     ;

                sum += t;
            }
        }
        printf("%llu\n", sum);
    }
}