#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
vector<int> E[MAXN];
int clr[MAXN], dep[MAXN];
int n, k, mxdep;
bool tag[MAXN];
int nxt(int x) { return (x == k) ? 1 : x + 1; }
int lst(int x) { return (x == 1) ? k : x - 1; }
void dfs1(int x, int f) {
  dep[x] = dep[f] + 1;
  for (auto v : E[x])
    if (v != f) dfs1(v, x);
}
int getpos(int x) {
  dfs1(x, 0);
  int mx = x;
  for (int i = 1; i <= n; i++)
    if (dep[i] > dep[mx]) mx = i;
  return mx;
}
void dfs2(int x, int f) {
  for (auto v : E[x])
    if (v != f) {
      dfs2(v, x);
      tag[x] |= tag[v];
    }
}
int f[MAXN], g[MAXN];
void dfs4(int x, int fa, int tp) {
  if (tp)
    clr[x] = nxt(clr[fa]);
  else
    clr[x] = lst(clr[fa]);
  for (auto v : E[x])
    if (v != fa) {
      dfs4(v, x, tp);
      if (f[v] + 1 > f[x])
        g[x] = f[x], f[x] = f[v] + 1;
      else if (f[v] + 1 > g[x])
        g[x] = f[v] + 1;
    }
  if (f[x] && g[x] && f[x] + g[x] + 1 >= k) {
    puts("No");
    exit(0);
  }
}
void dfs3(int x, int fa) {
  clr[x] = nxt(clr[fa]);
  f[x] = g[x] = 0;
  for (auto v : E[x])
    if (v != fa) {
      if (tag[v])
        dfs3(v, x);
      else {
        if (dep[x] <= mxdep - dep[x] + 1)
          dfs4(v, x, 0);
        else
          dfs4(v, x, 1);
        if (f[v] + 1 > f[x])
          g[x] = f[x], f[x] = f[v] + 1;
        else if (f[v] + 1 > g[x])
          g[x] = f[v] + 1;
      }
    }
  if (f[x] && g[x] && f[x] + g[x] + 1 >= k) {
    puts("No");
    exit(0);
  }
  if (f[x] && f[x] + dep[x] >= k && f[x] + mxdep - dep[x] + 1 >= k) {
    puts("No");
    exit(0);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    E[u].push_back(v);
    E[v].push_back(u);
  }
  if (k == 2) {
    puts("Yes");
    getpos(1);
    for (int i = 1; i <= n; i++) printf("%d ", (dep[i] & 1) + 1);
    puts("");
    return 0;
  }
  int p = getpos(1);
  int q = getpos(p);
  mxdep = dep[q];
  tag[q] = true;
  dfs2(p, 0);
  clr[0] = k;
  dfs3(p, 0);
  puts("Yes");
  for (int i = 1; i <= n; i++) printf("%d ", clr[i]);
  puts("");
  return 0;
}
