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 proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <class T>
inline T read() {
  register char c;
  register T x(0), f(1);
  while (!isdigit(c = getchar()))
    if (c == '-') f = -1;
  while (x = (x << 1) + (x << 3) + (c xor 48), isdigit(c = getchar()))
    ;
  return x * f;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
const int maxN = 1e5;
int n, m;
vector<int> ver[maxN + 2];
int fa[maxN + 2];
int f[maxN + 2][19], dfn[maxN + 2], dfst, dep[maxN + 2];
void get_f(int u) {
  dfn[u] = ++dfst;
  f[u][0] = fa[u];
  dep[u] = dep[fa[u]] + 1;
  for (int i = 1; i <= 18; ++i) f[u][i] = f[f[u][i - 1]][i - 1];
  for (int v : ver[u])
    if (v != fa[u]) get_f(v);
}
int get_lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int i = 18; ~i; --i)
    if (dep[f[u][i]] >= dep[v]) u = f[u][i];
  if (u == v) return u;
  for (int i = 18; ~i; --i)
    if (f[u][i] != f[v][i]) u = f[u][i], v = f[v][i];
  return f[u][0];
}
bool cmp_dfn(int x, int y) { return dfn[x] < dfn[y]; }
namespace v_tree {
int stk[maxN + 2], top;
bool mark[maxN + 2];
vector<int> p, V;
int fa[maxN + 2];
void clear() {
  for (int u : V) fa[u] = 0, mark[u] = 0;
  p.clear(), V.clear();
}
void add_point(int u) { p.push_back(u); }
void link(int u, int v) {
  fa[u] = v;
  V.push_back(v);
  V.push_back(u);
  mark[u] = mark[v] = 1;
}
void build() {
  sort((p).begin(), (p).end());
  p.erase(unique((p).begin(), (p).end()), p.end());
  sort((p).begin(), (p).end(), cmp_dfn);
  stk[top = 1] = 1;
  for (int i = 0; i < ((int)p.size()); ++i) {
    if (p[i] == 1) continue;
    int lca = get_lca(stk[top], p[i]);
    if (lca != stk[top]) {
      for (; dfn[stk[top - 1]] > dfn[lca]; --top) link(stk[top], stk[top - 1]);
      link(stk[top], lca);
      if (lca == stk[top - 1])
        top--;
      else
        stk[top] = lca;
    }
    stk[++top] = p[i];
  }
  for (int i = 1; i < top; ++i) link(stk[i + 1], stk[i]);
  sort((V).begin(), (V).end());
  V.erase(unique((V).begin(), (V).end()), V.end());
}
}  // namespace v_tree
int ans;
int val[maxN + 2];
int oper[maxN + 2];
int tag[maxN + 2];
int color[maxN + 2];
vector<int> w[maxN + 2];
void input() {
  n = read<int>(), m = read<int>();
  for (int i = 2; i <= n; ++i) fa[i] = read<int>(), ver[fa[i]].push_back(i);
  for (int i = 1; i <= n; ++i) val[i] = -read<int>();
  for (int i = 1; i <= m; ++i) oper[i] = read<int>();
}
const int SIZE = 600;
void work(int u) {
  if (u > 0) {
    color[u] ^= 1;
    ans -= val[u] > 0;
    val[u]++;
    for (int v = v_tree::fa[u]; v; u = v, v = v_tree::fa[v]) {
      ans += color[v] == 0 && val[v] == 0;
      val[v]++;
      int p = lower_bound((w[u]).begin(), (w[u]).end(), -tag[u]) - w[u].begin();
      if (p != ((int)w[u].size()) && w[u][p] == -tag[u])
        ans += upper_bound((w[u]).begin(), (w[u]).end(), -tag[u]) -
               w[u].begin() - p;
      tag[u]++;
    }
  } else {
    u = -u;
    color[u] ^= 1;
    val[u]--;
    ans += val[u] > 0;
    for (int v = v_tree::fa[u]; v; u = v, v = v_tree::fa[v]) {
      ans -= color[v] == 0 && val[v] == 1;
      val[v]--;
      int p =
          lower_bound((w[u]).begin(), (w[u]).end(), 1 - tag[u]) - w[u].begin();
      if (p != ((int)w[u].size()) && w[u][p] == 1 - tag[u])
        ans -= upper_bound((w[u]).begin(), (w[u]).end(), 1 - tag[u]) -
               w[u].begin() - p;
      tag[u]--;
    }
  }
}
void solve() {
  get_f(1);
  for (int i = 1; i <= m; i += SIZE) {
    int top = min(i + SIZE, m + 1) - 1;
    for (int j = i; j <= top; ++j) v_tree::add_point(abs(oper[j]));
    v_tree::build();
    for (int u : v_tree::V) {
      if (u == 1 || v_tree::mark[fa[u]]) continue;
      for (int v = fa[u]; !v_tree::mark[v]; v = fa[v])
        if (color[v] == 0) w[u].push_back(val[v]);
      sort((w[u]).begin(), (w[u]).end());
    }
    for (int j = i; j <= top; ++j) {
      work(oper[j]);
      printf("%d ", ans);
    }
    for (int u : v_tree::V) {
      if (u == 1 || v_tree::mark[fa[u]]) continue;
      for (int v = fa[u]; !v_tree::mark[v]; v = fa[v]) val[v] += tag[u];
    }
    for (int u : v_tree::V) w[u].clear(), tag[u] = 0;
    v_tree::clear();
  }
}
int main() {
  input();
  solve();
  return 0;
}