#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
struct Node {
  int preorder;
  int size;
  vector<int> children;
  vector<int> siblings;
};
Node g[MAXN];
int n, m;
int dfs(int v, int preorder, int parent) {
  g[v].preorder = preorder++;
  for (int i = 0; i < g[v].children.size(); i++) {
    if (g[v].children[i] == parent) {
      swap(g[v].children[i], g[v].children.back());
      g[v].children.pop_back();
      i--;
    } else
      preorder = dfs(g[v].children[i], preorder, v);
  }
  g[v].size = preorder - g[v].preorder;
  return preorder;
}
struct TreeNode {
  int left, right;
  int d;
  int sum;
};
int cap;
TreeNode t[4 * MAXN];
inline void update(int i) {
  if (i >= 2 * cap) return;
  if (t[i].d > 0) {
    t[i].sum = t[i].right - t[i].left + 1;
  } else if (i < cap) {
    t[i].sum = t[2 * i].sum + t[2 * i + 1].sum;
  } else {
    t[i].sum = 0;
  }
}
inline void add(int root, int left, int right, int d) {
  if (root >= 2 * cap) return;
  if (right < t[root].left || t[root].right < left) return;
  if (left <= t[root].left && t[root].right <= right) {
    t[root].d += d;
  } else {
    add(2 * root, left, right, d);
    add(2 * root + 1, left, right, d);
  }
  update(root);
}
int res[MAXN];
void dfs(int v) {
  for (int i = 0; i < g[v].siblings.size(); i++) {
    add(1, g[v].preorder, g[v].preorder + g[v].size - 1, 1);
    add(1, g[g[v].siblings[i]].preorder,
        g[g[v].siblings[i]].preorder + g[g[v].siblings[i]].size - 1, 1);
  }
  res[v] = max(t[1].sum - 1, 0);
  for (int i = 0; i < g[v].children.size(); i++) dfs(g[v].children[i]);
  for (int i = 0; i < g[v].siblings.size(); i++) {
    add(1, g[v].preorder, g[v].preorder + g[v].size - 1, -1);
    add(1, g[g[v].siblings[i]].preorder,
        g[g[v].siblings[i]].preorder + g[g[v].siblings[i]].size - 1, -1);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    g[u].children.push_back(v);
    g[v].children.push_back(u);
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    g[a].siblings.push_back(b);
    g[b].siblings.push_back(a);
  }
  dfs(0, 0, -1);
  cap = 1;
  while (cap < n) cap *= 2;
  for (int i = 0; i < cap; i++) {
    t[cap + i].left = t[cap + i].right = i;
    t[cap + i].d = 0;
    update(cap + i);
  }
  for (int i = cap - 1; i > 0; i--) {
    t[i].left = t[2 * i].left;
    t[i].right = t[2 * i + 1].right;
    t[i].d = 0;
    update(i);
  }
  dfs(0);
  for (int i = 0; i < n; i++) printf("%d ", res[i]);
  printf("\n");
}
