#include <bits/stdc++.h>
using namespace std;
const int maxn = 212345;
int n, k, s, t, f[maxn], dep[maxn], deps[maxn], dept[maxn], col[maxn];
bool in[maxn];
vector<int> G[maxn];
void dfs1(int u, int fa, int *mdep) {
  mdep[u] = dep[u] = dep[fa] + 1;
  f[u] = fa;
  for (int i = 0; i < (int)G[u].size(); ++i) {
    int v = G[u][i];
    if (v == fa) continue;
    dfs1(v, u, mdep);
    mdep[u] = max(mdep[u], mdep[v]);
  }
}
void dfs(int u, int fa, int c) {
  if (in[u])
    c = c % k + 1;
  else {
    int cnt = 0;
    if (deps[u] >= k) ++cnt;
    if (dept[u] >= k) ++cnt;
    if (cnt == 2) {
      puts("No");
      exit(0);
    }
    if (deps[u] >= k)
      c = c % k + 1;
    else
      c = (c + k - 2) % k + 1;
  }
  col[u] = c;
  for (int i = 0; i < (int)G[u].size(); ++i) {
    int v = G[u][i];
    if (v == fa) continue;
    dfs(v, u, c);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs1(1, 0, deps);
  if (k == 2) {
    puts("Yes");
    for (int i = 1; i <= n; ++i)
      printf("%d%c", dep[i] % 2 + 1, i == n ? '\n' : ' ');
    return 0;
  }
  for (int i = 1; i <= n; ++i)
    if (dep[i] > dep[s]) s = i;
  dfs1(s, 0, deps);
  for (int i = 1; i <= n; ++i)
    if (dep[i] > dep[t]) t = i;
  int tt = t;
  while (tt) {
    in[tt] = true;
    tt = f[tt];
  }
  dfs1(t, 0, dept);
  dfs(s, 0, 0);
  puts("Yes");
  for (int i = 1; i <= n; ++i) printf("%d%c", col[i], i == n ? '\n' : ' ');
  return 0;
}
