#include <bits/stdc++.h>   inline int read() {     int data = 0, w = 1;     char ch = getchar();     while (ch !=  -  && !std::isdigit(ch)) ch = getchar();     if (ch ==  - ) w = -1, ch = getchar();     while (std::isdigit(ch)) data = data * 10 + (ch ^ 48), ch = getchar();     return data * w;   }   const int N(1e5 + 10);   std::vector<int> G[N];   int n, m, val[N], fa[N], size[N], heavy[N];   int dfn[N], pos[N], bel[N], bot[N], cnt, ans;   void dfs(int x) {     size[x] = 1;     for (auto i : G[x]) {       dfs(i), size[x] += size[i];       if (size[heavy[x]] < size[i]) heavy[x] = i;     }   }   void dfs(int x, int c) {     pos[dfn[x] = ++cnt] = x, bel[x] = c, bot[bel[x]] = x;     if (heavy[x]) dfs(heavy[x], c);     for (auto i : G[x])       if (i != heavy[x]) dfs(i, i);   }   struct Chain {     int L, B, cnt;     std::vector<int> tag, bel, v, bl, br, vis;     std::vector<std::vector<int>> t;     void build(int l, int r) {       L = r - l + 1, B = std::sqrt(L), cnt = (L - 1) / B + 1;       tag.resize(cnt + 1), bel.resize(L + 1), vis.resize(L + 1);       bl.resize(cnt + 1), br.resize(cnt + 1), v.resize(L + 1);       for (int i = 1; i <= L; i++) bel[i] = (i - 1) / B + 1;       for (int i = 1; i <= L; i++) br[bel[i]] = i;       for (int i = L; i >= 1; i--) bl[bel[i]] = i;       t.assign(cnt + 1, std::vector<int>(B << 1 | 1));       for (int i = 1; i <= L; i++) v[i] = val[pos[i + l - 1]];       for (int i = 1; i <= L; i++)         if ((-B <= (v[i]) && (v[i]) <= B)) ++t[bel[i]][v[i] + B];     }     void rebuild(int x) {       for (int i = bl[x]; i <= br[x]; i++) v[i] -= tag[x];       tag[x] = 0, t[x].assign(B << 1 | 1, 0);       for (int i = bl[x]; i <= br[x]; i++)         if (!vis[i]) {           if ((-B <= (v[i]) && (v[i]) <= B)) ++t[x][v[i] + B];           if (v[i] <= tag[x]) ++ans;         }     }     void Brute_Modify(int x, int l, int r, int d) {       for (int i = l; i <= r; i++)         if (!vis[i]) {           if ((-B <= (v[i]) && (v[i]) <= B)) --t[x][v[i] + B];           if (v[i] <= tag[x]) --ans;         }       for (int i = l; i <= r; i++) v[i] += d;       for (int i = l; i <= r; i++)         if (!vis[i]) {           if ((-B <= (v[i]) && (v[i]) <= B)) ++t[x][v[i] + B];           if (v[i] <= tag[x]) ++ans;         }     }     void Modify(int l, int r, int d) {       if (bel[l] == bel[r]) return Brute_Modify(bel[l], l, r, -d);       for (int i = bel[l] + 1; i < bel[r]; i++) {         tag[i] += d;         if (!(-B <= (tag[i]) && (tag[i]) <= B)) {           for (int j = bl[i]; j <= br[i]; j++)             if (!vis[j] && v[j] <= tag[i] - d) --ans;           rebuild(i);         } else if (d == 1)           ans += t[i][tag[i] + B];         else           ans -= t[i][tag[i] + B + 1];       }       Brute_Modify(bel[l], l, br[bel[l]], -d);       Brute_Modify(bel[r], bl[bel[r]], r, -d);     }     void recol(int x, int d) {       int b = bel[x];       vis[x] = (d == 1);       if ((-B <= (v[x]) && (v[x]) <= B)) t[b][v[x] + B] -= d;       if (v[x] <= tag[b]) ans -= d;     }   } b[N];   int main() {     n = read(), m = read();     for (int i = 2; i <= n; i++) G[fa[i] = read()].push_back(i);     for (int i = 1; i <= n; i++) val[i] = read() + 1;     dfs(1), dfs(1, 1);     for (int i = 1; i <= n; i++)       if (bel[i] == i) b[i].build(dfn[i], dfn[bot[i]]);     for (int i = 1, x, o; i <= m; printf( %d  , ans), i++) {       x = read(), o = 1;       if (x < 0) o = -1, x = -x;       b[bel[x]].recol(dfn[x] - dfn[bel[x]] + 1, o);       for (; x; b[bel[x]].Modify(1, dfn[x] - dfn[bel[x]] + 1, o), x = fa[bel[x]])         ;     }     return 0;   }