#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

typedef long long ll;

/* global variables */

int n, q;
int prnts[MAX_N + 1];
bool marked[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  for (;;) {
    cin >> n >> q;
    if (n == 0) break;

    marked[1] = true;
    prnts[1] = 0;
    for (int i = 2; i <= n; i++) {
      cin >> prnts[i];
      marked[i] = false;
    }

    ll sum = 0;
    
    for (int qi = 0; qi < q; qi++) {
      char op;
      int i;
      cin >> op >> i;

      if (op == 'M') {
	marked[i] = true;
      }
      else {
	while (! marked[i]) i = prnts[i];
	sum += i;
      }
    }

    cout << sum << endl;
  }

  return 0;
}