#include <bits/stdc++.h>
using namespace std;
const int N = 100123;
const int inf = 1e9 + 2;
const int SQ = 300;
int z, n, m, a, b;
int pre[N];
int post[N];
int par[N];
int val[N];
int add[N];
int sum[N];
int ans[N];
int T;
vector<int> nbs[N];
vector<int> qs[N];
vector<int> buckets;
bool inter(int a, int b, int p, int q) { return max(a, p) <= min(b, q); }
void update(int b, int le, int ri, int v) {
  int s = buckets[b];
  int e = buckets[b + 1] - 1;
  for (int i = s; i <= e; i++) {
    val[i] += add[b];
  }
  add[b] = 0;
  for (int i = le; i <= ri; i++) {
    val[i] += v;
    assert(val[i] >= 0);
  }
  int mn = inf;
  for (int i = s; i <= e; i++) {
    mn = min(mn, val[i]);
  }
  add[b] = mn;
  sum[b] = e - s + 1;
  for (int i = s; i <= e; i++) {
    val[i] -= mn;
    if (!val[i]) sum[b]--;
  }
}
void change_range(int le, int ri, int v) {
  vector<int> affected;
  for (int i = 0; i < (int)buckets.size() - 1; i++) {
    int b = buckets[i];
    int nb = buckets[i + 1];
    if (inter(b, nb - 1, le, ri)) affected.push_back(i);
  }
  assert(affected.size());
  if (affected.size() <= 1) {
    update(affected[0], le, ri, v);
  } else {
    for (int i = 1; i < (int)affected.size() - 1; i++) {
      add[affected[i]] += v;
    }
    update(affected.front(), le, buckets[affected[1]] - 1, v);
    update(affected.back(), buckets[affected.back()], ri, v);
  }
}
void add_v(int v) { change_range(pre[v], post[v], 1); }
void remove_v(int v) { change_range(pre[v], post[v], -1); }
int get_sum(int b, int v) {
  int s = buckets[b];
  int e = buckets[b + 1] - 1;
  int res = 0;
  if (add[b]) {
    res += e - s + 1;
    if (pre[v] >= s && pre[v] <= e) res--;
  } else if (pre[v] >= s && pre[v] <= e) {
    for (int i = s; i <= e; i++) res += (i != pre[v] && val[i]);
  } else
    res += sum[b];
  return res;
}
void dfs1(int v, int p) {
  pre[v] = ++T;
  par[v] = p;
  for (int w : nbs[v])
    if (w != p) {
      dfs1(w, v);
    }
  post[v] = T;
}
void dfs2(int v, int p) {
  for (int q : qs[v]) {
    add_v(q);
  }
  if (qs[v].size()) add_v(v);
  int cans = 0;
  for (int b = 0; b < (int)buckets.size() - 1; b++) {
    cans += get_sum(b, v);
  }
  ans[v] = cans;
  for (int w : nbs[v])
    if (w != p) {
      dfs2(w, v);
    }
  for (int q : qs[v]) {
    remove_v(q);
  }
  if (qs[v].size()) remove_v(v);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < (int)n - 1; i++) {
    cin >> a >> b;
    nbs[a].push_back(b);
    nbs[b].push_back(a);
  }
  dfs1(1, 0);
  for (int i = 0; i < (int)m; i++) {
    cin >> a >> b;
    qs[a].push_back(b);
    qs[b].push_back(a);
  }
  buckets.push_back(1);
  int sq = SQ;
  int cur = sq;
  while (cur < n) {
    buckets.push_back(cur);
    cur += sq;
  }
  buckets.push_back(n + 1);
  dfs2(1, 0);
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
