#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000 + 100;
int x, y;
struct link_edge {
  int v, next;
} edge[maxn];
int en;
int g[maxn];
int ct[maxn];
struct node {
  int id, pre;
  int l, r;
  int data;
} tree[maxn];
vector<int> que[maxn];
int n, m, p, q;
int id;
int ans[maxn];
struct segmenttree {
  int add[maxn << 2];
  int dt[maxn << 2];
  void init() {
    memset(dt, 0, sizeof dt);
    memset(add, 0, sizeof add);
  }
  void pushup(int id, int m) {
    if (add[id]) {
      dt[id] = m;
      return;
    } else if (m == 1)
      dt[id] = 0;
    else
      dt[id] = dt[id << 1] + dt[id << 1 | 1];
  }
  void modify(int L, int R, int id, int l, int r, int c) {
    if (L == l && R == r) {
      add[id] += c;
      pushup(id, r - l + 1);
      return;
    }
    int m = (l + r) >> 1;
    if (R <= m)
      modify(L, R, id << 1, l, m, c);
    else if (L > m)
      modify(L, R, id << 1 | 1, m + 1, r, c);
    else {
      modify(L, m, id << 1, l, m, c);
      modify(m + 1, R, id << 1 | 1, m + 1, r, c);
    }
    pushup(id, r - l + 1);
  }
} sgt;
void dfs(int i, int pre) {
  tree[i].id = id;
  for (int j = g[i]; j != -1; j = edge[j].next) {
    if (edge[j].v == pre) continue;
    id++;
    dfs(edge[j].v, i);
  }
}
void dfs_find(int i, int &minn, int &maxx, int pre) {
  int k;
  minn = tree[i].id;
  maxx = tree[i].id;
  for (int j = g[i]; j != -1; j = edge[j].next) {
    k = edge[j].v;
    if (k == pre) continue;
    dfs_find(k, tree[k].l, tree[k].r, i);
    maxx = max(maxx, tree[k].r);
  }
  if (minn == 999999999) minn = tree[i].id;
}
void work(int u, int pre) {
  for (int i = 0; i < que[u].size(); i++) {
    int v = que[u][i];
    sgt.modify(tree[v].l, tree[v].r, 1, 1, n, 1);
  }
  ans[u] += sgt.dt[1];
  if (ans[u]) ans[u]--;
  for (int j = g[u]; j != -1; j = edge[j].next) {
    if (edge[j].v == pre) continue;
    work(edge[j].v, u);
  }
  for (int i = 0; i < que[u].size(); i++) {
    int v = que[u][i];
    sgt.modify(tree[v].l, tree[v].r, 1, 1, n, -1);
  }
}
int main() {
  memset(g, -1, sizeof g);
  memset(ans, 0, sizeof ans);
  en = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    edge[en].v = y;
    edge[en].next = g[x];
    g[x] = en;
    en++;
    edge[en].v = x;
    edge[en].next = g[y];
    g[y] = en;
    en++;
  }
  tree[1].id = 1;
  id = 1;
  dfs(1, -1);
  dfs_find(1, tree[1].l, tree[1].r, -1);
  sgt.init();
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    que[x].push_back(x);
    que[x].push_back(y);
    que[y].push_back(x);
    que[y].push_back(y);
  }
  work(1, -1);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
