#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#define ti printf("YES\n");
typedef long long ll;
const int maxn=100005;
const int INF=0x3f3f3f3f;
const int mod=1e6;

using namespace std;

int pre[maxn];

int Find(int x)
{
    return x==pre[x]?x:Find(pre[x]);
}

int main()
{
    int n,m,x;
    char s[2];
    while(scanf("%d%d",&n,&m)&&(n+m))
    {
        pre[1]=1;
        for(int i=2; i<=n; i++)
            scanf("%d",&pre[i]);
        int ans=0;
        while(m--)
        {
            scanf("%s%d",s,&x);
            if(s[0]=='Q')
                ans+=Find(pre[x]);
            else
                pre[x]=x;
        }
        printf("%d\n",ans);
    }
}