/*************************************************************************
	> File Name: aoj2170.cpp
	> Author: BMan
	> Mail: luo-kai-jia@163.com
	> Created Time: Tue 23 Oct 2018 08:16:34 PM CST
 ************************************************************************/

#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <limits.h>
#include <queue>
#include <math.h>
#include <iostream>

#define FOR(i, x, y) for (int i = x; i <= y; i++)
#define REPEAT(_N) for (int _i = 0; _i < _N; _i++)


using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

inline bool Read(int &a) { return scanf("%d", &a) != EOF; }
inline bool Read(int &a, int &b) { return scanf("%d%d", &a, &b) != EOF; }
inline bool Read(int &a, int &b, int &c) { return scanf("%d%d%d", &a, &b, &c) != EOF; }

const int INF = 0x3f3f3f3f;

#define lson idx << 1, l, mid
#define rson idx << 1 | 1, mid + 1, r

const int maxn = 1e5 + 10;

int value[maxn << 2];
void Init(int n) {
    memset(value, 0, sizeof(value));
    value[1] = 1;
}

int level[maxn];
int node2id[maxn];
int num[maxn];

void Set(int idx, int newvalue)
{
    if (value[idx] == 0) {
        value[idx] = newvalue;
    } else {
        int cur_lv = level[node2id[value[idx]]];
        int new_lv = level[node2id[newvalue]];
        if (new_lv > cur_lv) {
            value[idx] = newvalue;
        }
    }
}

void PushDown(int idx)
{
    if (value[idx]) {
        Set(idx << 1, value[idx]);
        Set(idx << 1 | 1, value[idx]);
        value[idx] = 0;
    }
}

void Update(int idx, int l, int r, int lt, int rt, int newvalue)
{
    if (lt <= l && rt >= r) {
        Set(idx, newvalue);
    } else {
        PushDown(idx);
        int mid = (l + r) / 2;
        if (lt <= mid) {
            Update(lson, lt, rt, newvalue);
        }
        if (rt > mid) {
            Update(rson, lt, rt, newvalue);
        }
    }
}

int Query(int idx, int l, int r, int pos)
{
    if (l == r) {
        return value[idx];
    } else {
        PushDown(idx);
        int mid = (l + r) / 2;
        if (pos <= mid) return Query(lson, pos);
        else return Query(rson, pos);
    }
}

vector<int> g[maxn];
int n, q;


void Tree2Array(int u, int &cur_id, int lv)
{
    int id = ++cur_id;
    node2id[u] = id;
    num[id] = 1;
    level[id] = lv;
    for (int i = 0; i < g[u].size(); i++) {
        int v = g[u][i];
        Tree2Array(v, cur_id, lv + 1);
        num[id] += num[node2id[v]];
    }
}

char ReadOP() {
    char s[10];
    scanf("%s", s);
    return s[0];
}

int Process() {
    while(Read(n, q) && n) {
        FOR(i, 1, n) g[i].clear();
        FOR(i, 2, n) {
            int x;
            Read(x);
            g[x].push_back(i);
        }
        int cur_id = 0;
        Tree2Array(1, cur_id, 1);
        Init(n);

        LL ans = 0;
        REPEAT(q) {
            char op = ReadOP();
            int u;
            Read(u);
            int id = node2id[u];
            if (op == 'Q') {
                //printf("%d\n", Query(1, 1, n, id));
                ans += Query(1, 1, n, id);
            } else {
                Update(1, 1, n, id, id + num[id] - 1, u);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

int main() {
    std::ios::sync_with_stdio(false);
    return Process();
}


Measured memory_bytes: 19712