#include <bits/stdc++.h>
using namespace std;
int to[2 * 400010], nxt[2 * 400010], head[400010];
int p[400010], c[400010];
pair<int, int> loc[400010];
int rev[400010];
int edge, cnt;
bitset<66> s[3 * 400010];
struct Node {
  int st, en;
  int flag;
  int col;
} mem[3 * 400010];
void add_edge(int u, int v) {
  to[edge] = v;
  nxt[edge] = head[u];
  head[u] = edge++;
  to[edge] = u;
  nxt[edge] = head[v];
  head[v] = edge++;
  return;
}
void dfs(int u) {
  int v;
  loc[u].first = cnt;
  rev[cnt++] = u;
  for (int ID = head[u]; ID != -1; ID = nxt[ID]) {
    v = to[ID];
    if (v == p[u]) continue;
    p[v] = u;
    dfs(v);
  }
  loc[u].second = cnt;
}
void Push_up(int u) {
  int ls = 2 * u, rs = 2 * u + 1;
  s[u].reset();
  s[u] |= s[ls];
  s[u] |= s[rs];
  return;
}
void Make_Tree(int u, int st, int en) {
  int ls = 2 * u, rs = 2 * u + 1;
  mem[u].st = st;
  mem[u].en = en;
  mem[u].flag = 0;
  if (en == st + 1) {
    s[u].reset();
    s[u].set(c[rev[st]]);
    return;
  }
  int mid = (st + en) / 2;
  Make_Tree(ls, st, mid);
  Make_Tree(rs, mid, en);
  Push_up(u);
  return;
}
void Push_down(int u) {
  int ls = 2 * u, rs = 2 * u + 1;
  if (mem[u].flag == 0) return;
  mem[ls].flag = mem[rs].flag = 1;
  mem[ls].col = mem[rs].col = mem[u].col;
  s[ls].reset();
  s[rs].reset();
  s[ls].set(mem[u].col);
  s[rs].set(mem[u].col);
  mem[u].flag = 0;
  return;
}
void update(int u, int st, int en, int col) {
  int ls = 2 * u, rs = 2 * u + 1;
  st = max(st, mem[u].st);
  en = min(en, mem[u].en);
  if (en <= st) return;
  if (st == mem[u].st && en == mem[u].en) {
    s[u].reset();
    s[u].set(col);
    mem[u].flag = 1;
    mem[u].col = col;
    return;
  }
  Push_down(u);
  update(ls, st, en, col);
  update(rs, st, en, col);
  Push_up(u);
  return;
}
void calc(int u, int st, int en, bitset<66>& ss) {
  int ls = 2 * u, rs = 2 * u + 1;
  st = max(st, mem[u].st);
  en = min(en, mem[u].en);
  if (en <= st) return;
  if (st == mem[u].st && en == mem[u].en) {
    ss |= s[u];
    return;
  }
  Push_down(u);
  calc(ls, st, en, ss);
  calc(rs, st, en, ss);
  return;
}
int main() {
  int N, M, u, v, tp, col;
  bitset<66> ss;
  scanf("%d%d", &N, &M);
  for (int i = (0); i < (N); i++) scanf("%d", c + i);
  for (int i = (0); i < (N); i++) c[i]--;
  memset(p, 0xff, sizeof(p));
  memset(head, 0xff, sizeof(head));
  edge = 0;
  cnt = 0;
  for (int i = (0); i < (N - 1); i++) {
    scanf("%d%d", &u, &v);
    u--;
    v--;
    add_edge(u, v);
  }
  dfs(0);
  Make_Tree(1, 0, N);
  for (int q = (0); q < (M); q++) {
    scanf("%d", &tp);
    if (tp == 1) {
      scanf("%d%d", &u, &col);
      u--;
      col--;
      update(1, loc[u].first, loc[u].second, col);
    } else {
      scanf("%d", &u);
      u--;
      ss.reset();
      calc(1, loc[u].first, loc[u].second, ss);
      printf("%d\n", ss.count());
    }
  }
  return 0;
}
