#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int N = 100010;
int n, m, t[N], t1[N], lt[N], rt[N], tcur, treeRes[4 * N], treeUpd[4 * N],
    treeMin[4 * N], a[N], b[N], ans[N];
vector<int> g[N], qstart[N], qend[N];
void dfs(int v, int p) {
  tcur++;
  t[v] = tcur;
  t1[tcur] = v;
  lt[tcur] = tcur;
  rt[tcur] = tcur;
  for (int i = 0; i < g[v].size(); i++)
    if (g[v][i] != p) {
      dfs(g[v][i], v);
      rt[t[v]] = rt[t[g[v][i]]];
    }
}
void build(int v, int tl, int tr) {
  if (tl == tr) {
    treeMin[v] = 0;
    treeUpd[v] = 0;
    treeRes[v] = 1;
    return;
  }
  int tm = (tl + tr) / 2;
  build(v * 2, tl, tm);
  build(v * 2 + 1, tm + 1, tr);
  treeMin[v] = 0;
  treeUpd[v] = 0;
  treeRes[v] = treeRes[v * 2] + treeRes[v * 2 + 1];
}
void push(int v) {
  if (treeUpd[v] != 0) {
    treeUpd[v * 2] += treeUpd[v];
    treeUpd[v * 2 + 1] += treeUpd[v];
    treeMin[v * 2] += treeUpd[v];
    treeMin[v * 2 + 1] += treeUpd[v];
    treeUpd[v] = 0;
  }
}
void update(int v, int tl, int tr, int l, int r, int val) {
  if (l > r) return;
  if (l == tl && r == tr) {
    treeMin[v] += val;
    treeUpd[v] += val;
    return;
  }
  int tm = (tl + tr) / 2;
  push(v);
  update(v * 2, tl, tm, l, min(r, tm), val);
  update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, val);
  treeMin[v] = min(treeMin[v * 2], treeMin[v * 2 + 1]);
  if (treeMin[v * 2] < treeMin[v * 2 + 1])
    treeRes[v] = treeRes[v * 2];
  else if (treeMin[v * 2 + 1] < treeMin[v * 2])
    treeRes[v] = treeRes[v * 2 + 1];
  else
    treeRes[v] = treeRes[v * 2] + treeRes[v * 2 + 1];
}
int getRes() {
  if (treeMin[1] == 0) return n - treeRes[1];
  return n;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  tcur = 0;
  dfs(1, -1);
  for (int i = 1; i <= m; i++) scanf("%d%d", &a[i], &b[i]);
  for (int i = 1; i <= m; i++) {
    int l = lt[t[a[i]]], r = rt[t[a[i]]];
    qstart[l].push_back(i);
    qend[r].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    int l = lt[t[b[i]]], r = rt[t[b[i]]];
    qstart[l].push_back(i);
    qend[r].push_back(i);
  }
  build(1, 1, n);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < qstart[i].size(); j++) {
      int k = qstart[i][j];
      update(1, 1, n, lt[t[a[k]]], rt[t[a[k]]], 1);
      update(1, 1, n, lt[t[b[k]]], rt[t[b[k]]], 1);
    }
    ans[t1[i]] = max(0, getRes() - 1);
    for (int j = 0; j < qend[i].size(); j++) {
      int k = qend[i][j];
      update(1, 1, n, lt[t[a[k]]], rt[t[a[k]]], -1);
      update(1, 1, n, lt[t[b[k]]], rt[t[b[k]]], -1);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
