#include <bits/stdc++.h>
using namespace std;
int used[2 * 131072], full[2 * 131072];
int lo, hi;
void insert(int vr, int how, int beg = 0, int end = 131072 - 1) {
  if (hi < beg || end < lo) return;
  if (lo <= beg && end <= hi)
    full[vr] += how;
  else
    insert(2 * vr, how, beg, (beg + end) >> 1),
        insert(2 * vr + 1, how, ((beg + end) >> 1) + 1, end);
  if (full[vr])
    used[vr] = end - beg + 1;
  else if (vr >= 131072)
    used[vr] = 0;
  else
    used[vr] = used[2 * vr] + used[2 * vr + 1];
}
int N, M;
vector<int> fo[100010];
vector<pair<int, int> > add[100010];
int ans[100010];
pair<int, int> span[100010];
int tim = -1;
void dfs(int vr, int par) {
  if (par != -1) fo[vr].erase(find(fo[vr].begin(), fo[vr].end(), par));
  span[vr].first = ++tim;
  for (int i = 0; i < ((int)(fo[vr]).size()); ++i) dfs(fo[vr][i], vr);
  span[vr].second = tim;
}
void solve(int vr) {
  for (int i = 0; i < ((int)(add[vr]).size()); ++i) {
    lo = add[vr][i].first, hi = add[vr][i].second;
    insert(1, 1);
  }
  ans[vr] = used[1];
  if (ans[vr]) --ans[vr];
  for (int i = 0; i < ((int)(fo[vr]).size()); ++i) solve(fo[vr][i]);
  for (int i = 0; i < ((int)(add[vr]).size()); ++i) {
    lo = add[vr][i].first, hi = add[vr][i].second;
    insert(1, -1);
  }
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i < N; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    fo[a].push_back(b), fo[b].push_back(a);
  }
  dfs(0, -1);
  for (int i = 0; i < M; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    add[a].push_back(span[a]);
    add[a].push_back(span[b]);
    add[b].push_back(span[a]);
    add[b].push_back(span[b]);
  }
  solve(0);
  for (int i = 0; i < N; ++i) printf("%d%c", ans[i], (i + 1 == N ? '\n' : ' '));
  return 0;
}
