#include <bits/stdc++.h>
//typedef
//-------------------------#include <bits/stdc++.h>

const double pi = 3.141592653589793238462643383279;

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s)
{
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x)
{
  ostringstream sout;
  sout << x;
  return sout.str();
}
inline int readInt()
{
  int x;
  scanf("%d", &x);
  return x;
}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a) * (a))
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

//repetition
//------------------------------------------
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define MOD 1000000007

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;

#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

class UnionFind
{
public:
  vector<int> par;

  UnionFind(int sz_) : par(sz_)
  {
    for (ll i = 0; i < sz_; ++i)
      par[i] = i;
  }
  void init(int sz_)
  {
    par.resize(sz_);
    for (ll i = 0; i < sz_; ++i)
      par[i] = i;
  }

  int root(int x)
  {
    if (par[x] == x)
      return x;

    return par[x] = root(par[x]);
  }

  bool merge(int x, int y)
  {
    x = root(x);
    y = root(y);
    if (x != y)
    {
      par[y] = x;
    }
    return true;
  }

  bool issame(int x, int y)
  {
    return root(x) == root(y);
  }
};
int N, Q;
vector<vector<int>> g(100010);
bool marked[100010];
int pp[100010];

void dfs(int v, int p, int m, UnionFind &uf)
{
  int nm = m;
  if (marked[v])
    nm = v;

  pp[v] = p;
  uf.merge(nm, v);

  for (int i = 0; i < g[v].size(); i++)
  {
    dfs(g[v][i], v, nm, uf);
  }
}
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(4);
  while (cin >> N >> Q)
  {
    if (N == 0 && Q == 0)
      break;

    for (int i = 0; i < N; i++)
      g[i].clear();

    for (int i = 1; i < N; i++)
    {
      int a;
      cin >> a;
      a--;
      g[a].push_back(i);
    }

    UnionFind uf(N);
    memset(marked, false, sizeof(marked));

    marked[0] = true;
    vector<pair<char, int>> vp;
    for (int i = 0; i < Q; i++)
    {
      char c;
      int v;
      cin >> c >> v;
      v--;
      if (c == 'M')
      {
        if (marked[v])
          continue;

        marked[v] = true;
        vp.push_back(make_pair(c, v));
      }
      else
      {
        vp.push_back(make_pair(c, v));
      }
    }

    dfs(0, -1, -1, uf);

    ll ans = 0;
    reverse(all(vp));
    for (int i = 0; i < vp.size(); i++)
    {
      if (vp[i].first == 'Q')
      {
        ans += uf.root(vp[i].second) + 1;
        //cout << uf.root(vp[i].second) + 1 << endl;
      }
      else
      {
        marked[vp[i].second] = false;

        uf.merge(pp[vp[i].second], vp[i].second);
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 25456