#include <bits/stdc++.h>
template <class T>
T Min(const T &a, const T &b) {
  return a < b ? a : b;
}
template <class T>
T Max(const T &a, const T &b) {
  return a > b ? a : b;
}
template <class T>
bool Chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
bool Chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
struct fast_input {
  static const int L = 1 << 15 | 1;
  char buf[L], *l, *r;
  fast_input() { l = r = buf; }
  void Next(char &c) {
    if (l == r) r = (l = buf) + fread(buf, 1, L, stdin);
    c = l == r ? (char)EOF : *l++;
  }
  template <class T>
  void operator()(T &x) {
    char c, f = 0;
    for (Next(c); !isdigit(c); Next(c))
      if (c == '-') f = 1;
    for (x = 0; isdigit(c); Next(c)) x = x * 10 + c - '0';
    if (f) x = -x;
  }
} input;
const int N = 200000 + 47;
const int INF = 0x3f3f3f3f;
int head[N], nxt[N << 1], to[N << 1], tot;
int mc1[N], mc2[N], fc1[N], fc2[N], n, k, ans[N];
void add(int x, int y) {
  nxt[++tot] = head[x], head[x] = tot, to[tot] = y;
  nxt[++tot] = head[y], head[y] = tot, to[tot] = x;
}
void solvek2(int x, int fa) {
  for (int i = head[x]; i; i = nxt[i])
    if (to[i] != fa) ans[to[i]] = ans[x] ^ 1, solvek2(to[i], x);
}
bool check1(int x, int fa) {
  int mx1 = -INF, mx2 = -INF, fr1 = 0, fr2 = 0, s = 1;
  for (int i = head[x]; i; i = nxt[i])
    if (to[i] != fa) {
      if (!check1(to[i], x)) return false;
      s = mc1[to[i]] < 0 ? 1 : mc1[to[i]] + 1;
      if (std::min(mx1 + mx2, std::min(mx1, mx2) + s) >= k - 1) return false;
      if (s > mx1)
        mx2 = mx1, fr2 = fr1, fr1 = to[i], mx1 = s;
      else if (Chkmax(mx2, s))
        fr2 = to[i];
    }
  mc1[x] = mx1, mc2[x] = mx2, fc1[x] = fr1, fc2[x] = fr2;
  return true;
}
bool check2(int x, int fa) {
  int t, ft, u;
  for (int i = head[x]; i; i = nxt[i])
    if ((u = to[i]) != fa) {
      if (fc1[x] != to[i])
        t = mc1[x] + 1, ft = x;
      else
        t = mc2[x] + 1, ft = x;
      if (t < 0) t = 1, ft = x;
      if (std::min(mc1[u] + mc2[u], std::min(mc1[u], mc2[u]) + t) >= k - 1)
        return false;
      if (t > mc1[u])
        mc2[u] = mc1[u], fc2[u] = fc1[u], mc1[u] = t, fc1[u] = x;
      else if (Chkmax(mc2[u], t))
        fc2[u] = x;
      if (!check2(to[i], x)) return false;
    }
  return true;
}
int goal, maxl;
int getfp(int x, int fa, int d) {
  if (Chkmax(maxl, d)) goal = x;
  for (int i = head[x]; i; i = nxt[i])
    if (to[i] != fa) getfp(to[i], x, d + 1);
}
int p1, p2, c1, c2;
bool getc(int x, int fa, int d) {
  if (x == p2) return true;
  for (int i = head[x]; i; i = nxt[i])
    if (to[i] != fa) {
      if (getc(to[i], x, d + 1)) {
        if (d == maxl / 2 + 1 && !c1) c1 = x;
        if (to[i] == c1) c2 = x;
        return true;
      }
    }
  return false;
}
bool printd(int x, int fa) {
  if (x == p2) {
    ans[x] = 1;
    return true;
  }
  for (int i = head[x]; i; i = nxt[i])
    if (to[i] != fa && printd(to[i], x)) {
      ans[x] = ans[to[i]] + 1;
      if (ans[x] > k) ans[x] -= k;
      return true;
    }
  return false;
}
void printo(int x, int fa, int t) {
  for (int i = head[x]; i; i = nxt[i]) {
    if (to[i] == fa) continue;
    if (ans[to[i]])
      printo(to[i], x, t);
    else {
      ans[to[i]] = ans[x] + t;
      if (ans[to[i]] > k) ans[to[i]] -= k;
      if (ans[to[i]] < 1) ans[to[i]] += k;
      printo(to[i], x, t);
    }
  }
}
int main() {
  int x, y, z;
  input(n), input(k);
  for (int i = 2; i <= n; ++i) input(x), input(y), add(x, y);
  if (k == 2) {
    ans[1] = 1, solvek2(1, -1);
    for (int i = (1), i_end = (n); i <= i_end; ++i)
      if (!ans[i]) ans[i] = 2;
  } else {
    if (!check1(1, -1)) {
      puts("No");
      return 0;
    }
    if (!check2(1, -1)) {
      puts("No");
      return 0;
    }
    maxl = -1, getfp(1, -1, 1), p1 = goal;
    maxl = -1, getfp(goal, -1, 1), p2 = goal;
    getc(p1, -1, 1);
    printd(p1, -1);
    printo(c1, c2, -1);
    printo(c2, c1, 1);
  }
  puts("Yes");
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  putchar(10);
  return 0;
}
