#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000, N = 100000;
int n, m, beg[N + 5], fin[N + 5], timer, lazy[4 * N + 5], ans[N + 5];
pair<int, int> ST[4 * N + 5];
vector<int> v[N + 5], q[N + 5];
pair<int, int> merge(pair<int, int> a, pair<int, int> b) {
  if (a.first < b.first)
    return a;
  else if (a.first > b.first)
    return b;
  else
    return make_pair(a.first, a.second + b.second);
}
pair<int, int> init(int i, int b, int s) {
  if (b == s) return ST[i] = make_pair(0, 1);
  int o = (b + s) / 2;
  return ST[i] = merge(init(2 * i, b, o), init(2 * i + 1, o + 1, s));
}
pair<int, int> update(int i, int b, int s, int x, int y, int t) {
  if (x > s || y < b) return ST[i];
  if (x <= b && y >= s) {
    lazy[i] += t;
    ST[i].first += t;
    return ST[i];
  }
  int o = (b + s) / 2;
  ST[i] =
      merge(update(2 * i, b, o, x, y, t), update(2 * i + 1, o + 1, s, x, y, t));
  ST[i].first += lazy[i];
  return ST[i];
}
int count() { return ST[1].first ? n : n - ST[1].second; }
void dfs(int dad, int node) {
  beg[node] = ++timer;
  int sz = v[node].size();
  for (int i = 0; i < sz; i++) {
    int to = v[node][i];
    if (to != dad) {
      dfs(node, to);
    }
  }
  fin[node] = timer;
}
void solve(int dad, int node) {
  int sz = q[node].size();
  if (sz) update(1, 1, n, beg[node], fin[node], 1);
  for (int i = 0; i < sz; i++)
    update(1, 1, n, beg[q[node][i]], fin[q[node][i]], 1);
  ans[node] = count();
  sz = v[node].size();
  for (int i = 0; i < sz; i++) {
    int to = v[node][i];
    if (to != dad) {
      solve(node, to);
    }
  }
  sz = q[node].size();
  if (sz) update(1, 1, n, beg[node], fin[node], -1);
  for (int i = 0; i < sz; i++)
    update(1, 1, n, beg[q[node][i]], fin[q[node][i]], -1);
}
int main() {
  int x, y;
  scanf("%d %d", &n, &m);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &x, &y);
    q[x].push_back(y);
    q[y].push_back(x);
  }
  init(1, 1, n);
  dfs(0, 1);
  solve(0, 1);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i] - bool(ans[i]));
  puts("");
  return 0;
}
