#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, st[N], fn[N], timer, ans[N];
vector<int> adj[N], vec[N];
struct node {
  long long sum, lazy, sz, one;
  node() { sum = one = sz = lazy = 0; }
} seg[N << 2];
void dfs1(int v, int p = -1) {
  st[v] = timer++;
  for (auto u : adj[v]) {
    if (u == p) continue;
    dfs1(u, v);
  }
  fn[v] = timer;
}
void build(int id = 1, int b = 0, int e = n) {
  if (e - b == 1) {
    seg[id].sz = 1;
    return;
  }
  int mid = (b + e) >> 1, lc = id * 2, rc = lc | 1;
  build(lc, b, mid);
  build(rc, mid, e);
  seg[id].sz = seg[lc].sz + seg[rc].sz;
  return;
}
void add(int l, int r, int val, int id = 1, int b = 0, int e = n) {
  if (l >= e || b >= r) return;
  if (l <= b && e <= r) {
    seg[id].one += val;
    return;
  }
  int mid = (b + e) >> 1, lc = id * 2, rc = lc | 1;
  add(l, r, val, lc, b, mid);
  add(l, r, val, rc, mid, e);
  seg[id].sum = ((seg[lc].one) ? seg[lc].sz : seg[lc].sum) +
                ((seg[rc].one) ? seg[rc].sz : seg[rc].sum);
  return;
}
void dfs2(int v, int p = -1) {
  if (vec[v].size()) vec[v].push_back(v);
  for (auto u : vec[v]) {
    int l = st[u], r = fn[u];
    add(l, r, 1);
  }
  ans[v] = ((seg[1].one) ? n : seg[1].sum);
  if (ans[v]) ans[v]--;
  for (auto u : adj[v]) {
    if (u == p) continue;
    dfs2(u, v);
  }
  for (auto u : vec[v]) {
    int l = st[u], r = fn[u];
    add(l, r, -1);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n - 1; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  dfs1(0);
  build();
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    int l = st[b], r = fn[b];
    vec[a].push_back(b);
    l = st[a], r = fn[a];
    vec[b].push_back(a);
  }
  dfs2(0);
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << "\n";
}
