#include <bits/stdc++.h>
using namespace std;
const int TSZ = 1 << 17;
const int N = 100003;
vector<int> adj[N];
vector<int> upd[N];
int pre[N];
int sz[N];
int res[N];
int ta[2 * TSZ];
int tb[2 * TSZ];
void update(int a, int b, int c, int i = 1, int u = 0, int v = TSZ - 1) {
  if (a <= u && v <= b) {
    ta[i] += c;
    if (ta[i] == 0) {
      if (u == v)
        tb[i] = 0;
      else
        tb[i] = tb[2 * i] + tb[2 * i + 1];
    } else
      tb[i] = v - u + 1;
    return;
  }
  if (v < a || u > b) return;
  update(a, b, c, 2 * i, u, (u + v) / 2);
  update(a, b, c, 2 * i + 1, (u + v) / 2 + 1, v);
  tb[i] = (ta[i] ? v - u + 1 : tb[2 * i] + tb[2 * i + 1]);
}
int counter = 0;
void dfs1(int u, int p) {
  pre[u] = counter++;
  sz[u] = 1;
  for (vector<int>::iterator it = adj[u].begin(); it != adj[u].end(); ++it)
    if (*it != p) {
      dfs1(*it, u);
      sz[u] += sz[*it];
    }
}
void dfs2(int u, int p) {
  if (!upd[u].empty()) update(pre[u], pre[u] + sz[u] - 1, 1);
  for (vector<int>::iterator it = upd[u].begin(); it != upd[u].end(); ++it)
    update(pre[*it], pre[*it] + sz[*it] - 1, 1);
  update(pre[u], pre[u], 1);
  res[u] = tb[1] - 1;
  update(pre[u], pre[u], -1);
  for (vector<int>::iterator it = adj[u].begin(); it != adj[u].end(); ++it)
    if (*it != p) dfs2(*it, u);
  if (!upd[u].empty()) update(pre[u], pre[u] + sz[u] - 1, -1);
  for (vector<int>::iterator it = upd[u].begin(); it != upd[u].end(); ++it)
    update(pre[*it], pre[*it] + sz[*it] - 1, -1);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    upd[u].push_back(v);
    upd[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; ++i) {
    if (i > 1) printf(" ");
    printf("%d", res[i]);
  }
  printf("\n");
  return 0;
}
