Problem: It's May in Flatland, and there are m days in this month. Despite the fact that May Holidays are canceled long time ago, employees of some software company still have a habit of taking short or long vacations in May.

Of course, not all managers of the company like this. There are n employees in the company that form a tree-like structure of subordination: each employee has a unique integer id i between 1 and n, and each employee with id i (except the head manager whose id is 1) has exactly one direct manager with id p_i. The structure of subordination is not cyclic, i.e. if we start moving from any employee to his direct manager, then we will eventually reach the head manager. We define that an employee u is a subordinate of an employee v, if v is a direct manager of u, or the direct manager of u is a subordinate of v. Let s_i be the number of subordinates the i-th employee has (for example, s_1 = n - 1, because all employees except himself are subordinates of the head manager).

Each employee i has a bearing limit of t_i, which is an integer between 0 and s_i. It denotes the maximum number of the subordinates of the i-th employee being on vacation at the same moment that he can bear. If at some moment strictly more than t_i subordinates of the i-th employee are on vacation, and the i-th employee himself is not on a vacation, he becomes displeased.

In each of the m days of May exactly one event of the following two types happens: either one employee leaves on a vacation at the beginning of the day, or one employee returns from a vacation in the beginning of the day. You know the sequence of events in the following m days. Your task is to compute for each of the m days the number of displeased employees on that day.

Input

The first line contains two integers n and m (2 ≤ n, m ≤ 10^5) — the number of employees in the company and the number of days in May.

The second line contains n - 1 integers p_2, p_3, …, p_n (1 ≤ p_i ≤ n), denoting the direct managers of employees.

The third line contains n integers t_1, t_2, …, t_n (0 ≤ t_i ≤ s_i), denoting the bearing limits of empoyees.

The fourth line contains m integers q_1, q_2, …, q_m (1 ≤ |q_i| ≤ n, q_i ≠ 0), denoting the events. If q_i is positive, then the employee with id q_i leaves for a vacation starting from this day, if q_i is negative, then the employee -q_i returns from a vacation starting from this day. In the beginning of May no employee is on vacation. It is guaranteed that if some employee leaves for a vacation, he is not on a vacation at the moment and vice versa.

Output

Print a sequence of m integers a_1, a_2, …, a_m, where a_i is the number of displeased employees on the i-th day.

Examples

Input

7 8
4 5 1 1 5 5
0 0 0 1 2 0 0
2 6 3 7 -2 4 -3 1


Output

1 1 1 2 2 2 1 0


Input

5 6
1 2 3 4
4 0 0 1 0
1 5 2 3 -5 -1


Output

0 2 1 0 0 0

Note

In the first sample test after employee with id 2 leaves for a vacation at the first day, the head manager with id 1 becomes displeased as he does not want any of his subordinates to go for a vacation. At the fourth day employee with id 5 becomes displeased as his last remaining employee with id 7 leaves for a vacation. At the fifth day employee with id 2 returns from the vacation, but it does not affect the number of displeased employees as the employees 5 and 1 are still displeased. At the sixth day employee with id 3 returns back from the vacation, preventing the employee with id 5 from being displeased and at the last day the head manager with id 1 leaves for a vacation, leaving the company without the displeased people at all.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
inline void writes(string s) { puts(s.c_str()); }
inline void writeln() { writes(""); }
inline void writei(int x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline void writell(long long x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
int n, m, i, j, lst, t[100005], w[100005], col[100005], dfn[100005],
    fa[100005][19], dep[100005], stk[100005], tp, blk, ti, a[100005],
    ixt[100005], ans[100005], cur, dup[100005], ixf[100005], cq, duv[100005];
vector<int> e[100005], ee[100005], all, tmp;
vector<pair<int, int> > dur[100005];
int seq[100005];
void add(int x, int y) {
  all.push_back(x);
  all.push_back(y);
  ee[x].push_back(y);
  ee[y].push_back(x);
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) {
    swap(x, y);
  }
  int t = dep[x] - dep[y], i;
  for ((i) = (18); (i) >= (0); (i)--) {
    if ((t >> i) & 1) {
      x = fa[x][i];
    }
  }
  if (x == y) return x;
  for ((i) = (18); (i) >= (0); (i)--) {
    if (fa[x][i] != fa[y][i]) {
      x = fa[x][i];
      y = fa[y][i];
    }
  }
  return fa[x][0];
}
void dfs(int x) {
  dfn[x] = ++ti;
  for (__typeof((e[x]).begin()) it = (e[x]).begin(); it != (e[x]).end(); it++) {
    dep[*it] = dep[x] + 1;
    dfs(*it);
  }
}
void dfs2(int x) {
  for (__typeof((e[x]).begin()) it = (e[x]).begin(); it != (e[x]).end(); it++) {
    dfs2(*it);
    w[x] += w[*it];
  }
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
void ins(int x) {
  if (tp <= 1) {
    stk[++tp] = x;
    return;
  }
  int z = lca(stk[tp], x);
  if (z == stk[tp]) {
    stk[++tp] = x;
    return;
  }
  while (tp > 1 && dfn[stk[tp - 1]] >= dfn[z]) {
    add(stk[tp], stk[tp - 1]);
    tp--;
  }
  if (stk[tp] != z) {
    add(stk[tp], z);
    stk[tp] = z;
  }
  stk[++tp] = x;
}
void ine(int x, int y) {
  int id = y;
  duv[id] = 0;
  y = fa[y][0];
  tmp.clear();
  while (y != x) {
    ixt[y] = 1;
    if (!col[y]) tmp.push_back(t[y] - w[y]);
    y = fa[y][0];
  }
  sort(tmp.begin(), tmp.end());
  dur[id].clear();
  for (__typeof((tmp).begin()) it = (tmp).begin(); it != (tmp).end(); it++) {
    if (dur[id].empty()) {
      dur[id].push_back(make_pair(*it, 1));
    } else if (dur[id].back().first == *it) {
      dur[id].back().second++;
    } else {
      dur[id].push_back(make_pair(*it, dur[id].back().second + 1));
    }
  }
  for (dup[id] = 0; dup[id] < dur[id].size(); dup[id]++)
    if (duv[id] <= dur[id][dup[id]].first) break;
  dup[id]--;
  cur += (dup[id] == -1 ? 0 : dur[id][dup[id]].second);
}
void dfs3(int x, int fa) {
  ixf[x] = fa;
  ixt[x] = 1;
  if (!col[x]) cur += (w[x] > t[x]);
  for (__typeof((ee[x]).begin()) it = (ee[x]).begin(); it != (ee[x]).end();
       it++)
    if (*it != fa) {
      ine(x, *it);
      dfs3(*it, x);
    }
}
void dfs4(int x) {
  if (!ixt[x]) {
    if (!col[x]) cur += (w[x] > t[x]);
  }
  for (__typeof((e[x]).begin()) it = (e[x]).begin(); it != (e[x]).end(); it++) {
    dfs4(*it);
  }
}
void upe(int x, int dlt) {
  duv[x] += dlt;
  cur -= (dup[x] == -1 ? 0 : dur[x][dup[x]].second);
  while (dup[x] + 1 < dur[x].size() && duv[x] > dur[x][dup[x] + 1].first)
    dup[x]++;
  while (dup[x] > -1 && duv[x] <= dur[x][dup[x]].first) dup[x]--;
  cur += (dup[x] == -1 ? 0 : dur[x][dup[x]].second);
}
void work(int x) {
  int dlt = x / abs(x), fst = 1;
  x = abs(x);
  while (x) {
    if (!col[x]) cur -= (w[x] > t[x]);
    if (fst) col[x] += dlt;
    fst = 0;
    w[x] += dlt;
    if (!col[x]) cur += (w[x] > t[x]);
    if (x != 1) upe(x, dlt);
    x = ixf[x];
  }
}
void solve(int ed) {
  int i;
  cur = 0;
  all.clear();
  memset(w, 0, sizeof(w));
  memset(ixt, 0, sizeof(ixt));
  for (((i)) = (1); ((i)) <= ((lst)); ((i))++) {
    if (seq[i] > 0) {
      w[seq[i]] = col[seq[i]] = 1;
    } else {
      w[-seq[i]] = col[-seq[i]] = 0;
    }
  }
  dfs2(1);
  for ((i) = (lst + 1); (i) <= (ed); (i)++) {
    a[i - lst] = abs(seq[i]);
  }
  sort(a + 1, a + (ed - lst) + 1, cmp);
  stk[tp = 1] = 1;
  for (((i)) = (1); ((i)) <= ((ed - lst)); ((i))++) {
    if (a[i] != 1 && a[i] != a[i - 1]) {
      ins(a[i]);
    }
  }
  while (tp >= 2) {
    add(stk[tp], stk[tp - 1]);
    tp--;
  }
  dfs3(1, 0);
  dfs4(1);
  for ((i) = (lst + 1); (i) <= (ed); (i)++) {
    work(seq[i]);
    printf("%d ", cur);
  }
  for (__typeof((all).begin()) it = (all).begin(); it != (all).end(); it++) {
    ee[*it].clear();
  }
}
int main() {
  read(n);
  read(m);
  blk = sqrt(m) * 2;
  for ((i) = (2); (i) <= (n); (i)++) {
    scanf("%d", &fa[i][0]);
    e[fa[i][0]].push_back(i);
  }
  for (((j)) = (1); ((j)) <= ((18)); ((j))++)
    for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
      fa[i][j] = fa[fa[i][j - 1]][j - 1];
    }
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    scanf("%d", &t[i]);
  }
  dfs(1);
  lst = 0;
  for (((i)) = (1); ((i)) <= ((m)); ((i))++) {
    scanf("%d", &seq[i]);
    if (i % blk == 0) {
      solve(i);
      lst = i;
    }
  }
  if (lst < m) solve(m);
  return 0;
}