#include <bits/stdc++.h>
using namespace std;
int head[200010], to[200010 << 1], nxt[200010 << 1], idx, col[200010],
    dis[200010], fa[200010], point[200010], n, k, en[2], mx[200010],
    smx[200010];
void add(int a, int b) { nxt[++idx] = head[a], to[idx] = b, head[a] = idx; }
void dfs(int p, int from) {
  fa[p] = from, dis[p] = dis[from] + 1;
  for (int i = head[p]; i; i = nxt[i])
    if (to[i] != from) dfs(to[i], p);
}
void init(int kind) {
  for (int i = 1; i <= n; i++)
    if (dis[i] > dis[en[kind]]) en[kind] = i;
  for (int i = 1; i <= n; i++) dis[i] = 0;
}
void dfs2(int p, int from) {
  dis[p] = dis[from] + 1, mx[p] = 1, smx[p] = 1;
  for (int i = head[p]; i; i = nxt[i])
    if (to[i] != from) {
      dfs2(to[i], p), smx[p] = max(smx[p], mx[to[i]] + 1);
      if (smx[p] > mx[p]) swap(smx[p], mx[p]);
    }
}
void dfs3(int p, int from, int now) {
  if (!col[p]) col[p] = now;
  for (int i = head[p]; i; i = nxt[i])
    if (to[i] != from) dfs3(to[i], p, (now - 1) ? now - 1 : k);
}
void dfs4(int p, int from, int now) {
  if (!col[p]) col[p] = now;
  for (int i = head[p]; i; i = nxt[i])
    if (to[i] != from) dfs4(to[i], p, now % k + 1);
}
void colur() {
  for (int i = en[1]; i; i = fa[i]) point[++point[0]] = i;
  reverse(point + 1, point + point[0] + 1);
  for (int i = 1; i <= point[0]; i++) col[point[i]] = (i - 1) % k + 1;
  if (point[0] % 2)
    dfs3(point[point[0] / 2 + 1], point[point[0] / 2 + 2],
         col[point[point[0] / 2 + 1]]),
        dfs4(point[point[0] / 2 + 1], point[point[0] / 2],
             col[point[point[0] / 2 + 1]]);
  else
    dfs3(point[point[0] / 2], point[point[0] / 2 + 1],
         col[point[point[0] / 2]]),
        dfs4(point[point[0] / 2 + 1], point[point[0] / 2],
             col[point[point[0] / 2 + 1]]);
  for (int i = 1; i <= n; i++) printf("%d ", col[i]);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1, x, y; i < n; i++) scanf("%d%d", &x, &y), add(x, y), add(y, x);
  dfs(1, 0), init(0), dfs(en[0], 0), init(1), dfs2(en[0], 0);
  if (k == 2) printf("Yes\n"), colur(), exit(0);
  for (int i = 1; i <= n; i++) {
    int tmp = min(dis[i], mx[i]), tmp2 = smx[i];
    if (tmp + tmp2 - 1 >= k && tmp2 > 1) printf("No\n"), exit(0);
  }
  printf("Yes\n"), colur();
}
