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>
namespace CPTH {
class HLD {
 public:
  HLD(size_t size = 0);
  void init(size_t size);
  void addEdge(size_t u, size_t v);
  void build(size_t root = 1);
  size_t lca(size_t u, size_t v) const;
  size_t id(size_t u) const;
  size_t atId(size_t x) const;
  size_t top(size_t u) const;
  size_t size(size_t u) const;
  size_t depth(size_t u) const;
  size_t bottom(size_t u) const;
  size_t parent(size_t u) const;
  size_t heavyChild(size_t u) const;
  std::vector<size_t> children(size_t u) const;
  std::pair<size_t, size_t> subtree(size_t u) const;
  std::vector<std::pair<size_t, size_t>> path(size_t u, size_t v) const;

 private:
  void dfs1(size_t u);
  void dfs2(size_t u);
  void validate(size_t u) const;
  void reset();

 private:
  bool built;
  size_t n, dfntot;
  std::vector<std::vector<size_t>> g;
  std::vector<size_t> pa, heavy, dep, siz, tp, bt, dfn, rdfn, exi;
};
HLD::HLD(size_t size) { init(size); }
void HLD::init(size_t size) {
  assert(size < g.max_size());
  assert(size < pa.max_size());
  n = size;
  g.clear();
  g.resize(n + 1);
  reset();
}
void HLD::addEdge(size_t u, size_t v) {
  validate(u);
  validate(v);
  g[u].push_back(v);
  g[v].push_back(u);
}
void HLD::build(size_t root) {
  if (built) {
    if (root == atId(1)) return;
    reset();
  }
  assert(n >= 1);
  validate(root);
  dfs1(root);
  tp[root] = root;
  dfs2(root);
  assert(dfntot == n);
  built = true;
}
size_t HLD::lca(size_t u, size_t v) const {
  assert(built);
  validate(u);
  validate(v);
  while (tp[u] != tp[v]) {
    if (dep[tp[u]] > dep[tp[v]])
      u = pa[tp[u]];
    else
      v = pa[tp[v]];
  }
  return dep[u] < dep[v] ? u : v;
}
size_t HLD::id(size_t u) const {
  assert(built);
  validate(u);
  return dfn[u];
}
size_t HLD::atId(size_t x) const {
  assert(built);
  validate(x);
  return rdfn[x];
}
size_t HLD::top(size_t u) const {
  assert(built);
  validate(u);
  return tp[u];
}
size_t HLD::size(size_t u) const {
  assert(built);
  validate(u);
  return siz[u];
}
size_t HLD::depth(size_t u) const {
  assert(built);
  validate(u);
  return dep[u];
}
size_t HLD::bottom(size_t u) const {
  assert(built);
  validate(u);
  return bt[tp[u]];
}
size_t HLD::parent(size_t u) const {
  assert(built);
  validate(u);
  return pa[u];
}
size_t HLD::heavyChild(size_t u) const {
  assert(built);
  validate(u);
  return heavy[u];
}
std::vector<size_t> HLD::children(size_t u) const {
  auto ret = g[u];
  if (pa[u]) ret.erase(std::find(ret.begin(), ret.end(), pa[u]));
  return ret;
}
std::pair<size_t, size_t> HLD::subtree(size_t u) const {
  assert(built);
  validate(u);
  return {dfn[u], exi[u]};
}
std::vector<std::pair<size_t, size_t>> HLD::path(size_t u, size_t v) const {
  assert(built);
  validate(u);
  validate(v);
  std::vector<std::pair<size_t, size_t>> res;
  while (tp[u] != tp[v]) {
    if (dep[tp[u]] > dep[tp[v]]) {
      res.emplace_back(dfn[tp[u]], dfn[u]);
      u = pa[tp[u]];
    } else {
      res.emplace_back(dfn[tp[v]], dfn[v]);
      v = pa[tp[v]];
    }
  }
  if (dep[u] > dep[v]) std::swap(u, v);
  res.emplace_back(dfn[u], dfn[v]);
  return res;
}
void HLD::dfs1(size_t u) {
  assert(siz[u] == 0);
  siz[u] = 1;
  for (auto v : g[u]) {
    if (v == pa[u]) continue;
    dep[v] = dep[u] + 1;
    pa[v] = u;
    dfs1(v);
    siz[u] += siz[v];
    if (siz[v] > siz[heavy[u]]) heavy[u] = v;
  }
}
void HLD::dfs2(size_t u) {
  bt[tp[u]] = u;
  dfn[u] = ++dfntot;
  rdfn[dfn[u]] = u;
  if (heavy[u]) {
    tp[heavy[u]] = tp[u];
    dfs2(heavy[u]);
    for (auto v : g[u]) {
      if (v == pa[u] || v == heavy[u]) continue;
      tp[v] = v;
      dfs2(v);
    }
  }
  exi[u] = dfntot;
}
void HLD::validate(size_t u) const {
  assert(u >= 1);
  assert(u <= n);
}
void HLD::reset() {
  built = false;
  dfntot = 0;
  pa.assign(n + 1, 0);
  heavy = dep = siz = tp = bt = dfn = rdfn = exi = pa;
}
}  // namespace CPTH
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
const double inf = 1e121;
const double eps = 1e-10;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long randint(long long l, long long r) {
  long long out = rng() % (r - l + 1) + l;
  return out >= l ? out : out + r - l + 1;
}
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (long long i = 0; i < static_cast<long long>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," +
         to_string(get<4>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
template <typename T>
struct is_pair {
  static const bool value = false;
};
template <typename T, typename U>
struct is_pair<std::pair<T, U>> {
  static const bool value = true;
};
const long long INF = 0x3f3f3f3f3f3f3f3fll;
template <typename T>
typename enable_if<!is_integral<T>::value && !is_pair<T>::value, void>::type
read(T &x) {
  cin >> x;
}
long long read() {
  char c;
  long long out = 0, f = 1;
  for (c = getchar(); !isdigit(c) && c != '-'; c = getchar()) {
  }
  if (c == '-') {
    f = -1;
    c = getchar();
  }
  for (; isdigit(c); c = getchar()) out = (out << 3) + (out << 1) + c - '0';
  return out * f;
}
template <typename T>
typename enable_if<is_integral<T>::value, T>::type read(T &x) {
  char c;
  T f = 1;
  x = 0;
  for (c = getchar(); !isdigit(c) && c != '-'; c = getchar()) {
  }
  if (c == '-') {
    f = -1;
    c = getchar();
  }
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  return x *= f;
}
char read(char &x) {
  for (x = getchar(); isspace(x); x = getchar()) {
  }
  return x;
}
double read(double &x) {
  scanf("%lf", &x);
  return x;
}
template <typename T>
typename enable_if<!is_integral<T>::value && !is_pair<T>::value, void>::type
write(const T &x) {
  cout << x;
}
template <typename T>
typename enable_if<is_integral<T>::value, void>::type write(const T &x) {
  if (x < 0) {
    putchar('-');
    write(-x);
    return;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
void write(char x) { putchar(x); }
void write(double x) { printf("%.12lf", x); }
void write(long double x) { cout << fixed << setprecision(12) << x; }
template <typename T>
typename enable_if<is_pair<T>::value, void>::type read(T &x) {
  read(x.first);
  read(x.second);
}
template <typename T>
typename enable_if<is_pair<T>::value, void>::type write(const T &x) {
  write(x.first);
  putchar(' ');
  write(x.second);
}
template <typename T, typename... Args>
void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
template <
    typename OutputIt,
    typename = typename enable_if<
        is_same<output_iterator_tag,
                typename iterator_traits<OutputIt>::iterator_category>::value ||
        (is_base_of<forward_iterator_tag, typename iterator_traits<OutputIt>::
                                              iterator_category>::value &&
         !is_const<OutputIt>::value)>::type>
void read(OutputIt __first, OutputIt __last) {
  for (; __first != __last; ++__first) read(*__first);
}
template <
    typename InputIt,
    typename = typename enable_if<is_base_of<
        input_iterator_tag,
        typename iterator_traits<InputIt>::iterator_category>::value>::type>
void wts(InputIt __first, InputIt __last) {
  bool isFirst = true;
  for (; __first != __last; ++__first) {
    if (isFirst)
      isFirst = false;
    else
      putchar(' ');
    write(*__first);
  }
  putchar('\n');
}
template <
    typename InputIt,
    typename = typename enable_if<is_base_of<
        input_iterator_tag,
        typename iterator_traits<InputIt>::iterator_category>::value>::type>
void wtb(InputIt __first, InputIt __last) {
  for (; __first != __last; ++__first) {
    write(*__first);
    putchar('\n');
  }
}
template <typename T>
void wts(const T &x) {
  write(x);
  putchar(' ');
}
template <typename T>
void wtb(const T &x) {
  write(x);
  putchar('\n');
}
template <typename T>
void wte(const T &x) {
  write(x);
  exit(0);
}
template <typename T, typename... Args>
void wts(const T &x, Args... args) {
  wts(x);
  wts(args...);
}
template <typename T, typename... Args>
void wtb(const T &x, Args... args) {
  wts(x);
  wtb(args...);
}
template <typename T, typename... Args>
void wte(const T &x, Args... args) {
  wts(x);
  wte(args...);
}
template <typename T1, typename T2>
inline bool up(T1 &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T1, typename T2>
inline bool dn(T1 &x, const T2 &y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T1, typename T2, typename T3>
inline bool inRange(const T1 &x, const T2 &l, const T3 &r) {
  return !(x < l) && !(r < x);
}
template <typename T1, typename T2>
inline auto minOfDifferentTypes(const T1 &x, const T2 &y)
    -> decltype(x < y ? x : y) {
  return x < y ? x : y;
}
template <typename T1, typename T2>
inline auto maxOfDifferentTypes(const T1 &x, const T2 &y)
    -> decltype(x < y ? y : x) {
  return x < y ? y : x;
}
template <typename T1, typename T2, typename T3>
inline T1 &madd(T1 &x, const T2 &y, const T3 &modulo) {
  return x = (long long)(x + y + modulo) % modulo;
}
template <typename T1, typename T2, typename T3>
inline T1 &mmul(T1 &x, const T2 &y, const T3 &modulo) {
  return x = (long long)x * y % modulo;
}
inline long long modadd(long long x, long long y, long long modulo) {
  return x + y >= modulo ? x + y - modulo : x + y;
}
inline long long isinf(long long x) { return x < INF ? x : -1; }
inline void yesno(bool x) { wtb(x ? "Yes" : "No"); }
signed main() {
  long long n, m;
  read(n, m);
  CPTH::HLD hld(n);
  for (long long i = (2), iend = (n); i <= iend; ++i) hld.addEdge(read(), i);
  hld.build();
  vector<long long> t(n + 1);
  read(((t).begin() + 1), (t).end());
  const long long B = sqrt(n) * 2;
  long long ans = 0;
  vector<long long> w(n + 1), vac(n + 1);
  for (long long i = (1), iend = (n); i <= iend; ++i) w[i] = -t[i];
  for (long long l = 0; l < m; l += B) {
    vector<long long> q(minOfDifferentTypes(B, m - l));
    read((q).begin(), (q).end());
    vector<long long> a;
    a.reserve(q.size() * 2);
    for (auto x : q) a.push_back(abs(x));
    a.push_back(1);
    sort((a).begin(), (a).end(),
         [&](long long x, long long y) { return hld.id(x) < hld.id(y); });
    for (long long i = (1), iend = (a.size() - 1); i <= iend; ++i)
      a.push_back(hld.lca(a[i - 1], a[i]));
    sort((a).begin(), (a).end(),
         [&](long long x, long long y) { return hld.id(x) < hld.id(y); });
    a.resize(unique((a).begin(), (a).end()) - a.begin());
    stack<long long> stk;
    vector<vector<long long>> g(n + 1);
    vector<long long> pa(n + 1);
    vector<bool> inv(n + 1);
    for (auto u : a) {
      inv[u] = true;
      if (u == 1) {
        stk.push(u);
        continue;
      }
      while (!inRange(hld.id(u), hld.subtree(stk.top()).first,
                      hld.subtree(stk.top()).second))
        stk.pop();
      g[stk.top()].push_back(u);
      pa[u] = stk.top();
      stk.push(u);
    }
    vector<vector<pair<long long, long long>>> bucket(n * 2);
    for (auto u : a) {
      if (u == 1) continue;
      for (long long x = hld.parent(u); !inv[x]; x = hld.parent(x))
        if (!vac[x]) bucket[w[x] + n].emplace_back(x, u);
    }
    vector<vector<pair<long long, long long>>> cnt(n + 1);
    vector<long long> delta(n + 1), p(n + 1, 0);
    for (const auto &buc : bucket) {
      for (auto x : buc) {
        if (cnt[x.second].empty() || cnt[x.second].back().first != w[x.first]) {
          cnt[x.second].emplace_back(w[x.first], 0);
          if (w[x.first] <= 0) p[x.second] = cnt[x.second].size();
        }
        ++cnt[x.second].back().second;
      }
    }
    for (auto u : q) {
      if (u > 0) {
        if (w[u] > 0) --ans;
        for (long long x = u; x != 1; x = pa[x]) {
          ++delta[x];
          if (p[x] && cnt[x][p[x] - 1].first + delta[x] > 0) {
            ans += cnt[x][--p[x]].second;
          }
          ++w[pa[x]];
          if (!vac[pa[x]] && w[pa[x]] == 1) ++ans;
        }
      } else {
        u = -u;
        if (w[u] > 0) ++ans;
        for (long long x = u; x != 1; x = pa[x]) {
          --delta[x];
          if (p[x] < (long long)cnt[x].size() &&
              cnt[x][p[x]].first + delta[x] <= 0) {
            ans -= cnt[x][p[x]++].second;
          }
          --w[pa[x]];
          if (!vac[pa[x]] && w[pa[x]] == 0) --ans;
        }
      }
      vac[u] ^= 1;
      wts(ans);
    }
    for (auto u : a) {
      if (u == 1) continue;
      for (long long x = hld.parent(u); !inv[x]; x = hld.parent(x)) {
        w[x] += delta[u];
      }
    }
  }
  return 0;
}