#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[200010], maxlen(200010), pathlen[200010], par(200010),
    color(200010);
long long n, k, root, dist, mxdist, far, mnk;
long long dfs1(long long loc, long long par) {
  pathlen[loc].push_back(0);
  dist++;
  for (auto &i : adj[loc]) {
    if (i != par) {
      if (mxdist < dist) {
        root = i;
        mxdist = dist;
      }
      pathlen[loc].push_back(dfs1(i, loc) + 1);
    }
  }
  dist--;
  sort(pathlen[loc].rbegin(), pathlen[loc].rend());
  pathlen[loc].resize(3);
  return maxlen[loc] = pathlen[loc][0];
}
void dfs2(long long loc, long long par, long long parlen = 0) {
  vector<long long> lvals = pathlen[loc];
  lvals.push_back(parlen);
  sort(lvals.rbegin(), lvals.rend());
  if (lvals[2]) mnk = max(mnk, lvals[1] + lvals[2] + 1);
  for (auto &i : adj[loc]) {
    if (i != par) {
      long long parln = pathlen[loc][0] + 1;
      if (maxlen[i] + 1 == pathlen[loc][0]) {
        parln = pathlen[loc][1] + 1;
      }
      parln = max(parln, parlen + 1);
      dfs2(i, loc, parln);
    }
  }
}
void dfs3(long long loc, long long par) {
  dist++;
  ::par[loc] = par;
  for (auto &i : adj[loc]) {
    if (i != par) {
      if (mxdist < dist) {
        far = i;
        mxdist = dist;
      }
      dfs3(i, loc);
    }
  }
  dist--;
}
void dfs4(long long loc, long long par, long long col, long long delta) {
  col = ((col + delta + k - 1) % k) + 1;
  color[loc] = col;
  for (auto &i : adj[loc]) {
    if (i != par) {
      dfs4(i, loc, col, delta);
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  long long x, y;
  for (long long i = 1; i < n; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs1(1, 1);
  dfs2(1, 1);
  bool poss = ((k > mnk) || k <= 2);
  if (!poss) {
    cout << "No";
  } else {
    mxdist = 0;
    dfs3(root, root);
    long long prev = far;
    for (long long i = 0; i <= mxdist; i++) {
      color[far] = (i % k) + 1;
      for (auto &j : adj[far]) {
        if (j != par[far] && j != prev) {
          dfs4(j, far, color[far], 1 - 2 * (2 * i <= mxdist));
        }
      }
      prev = far;
      far = par[far];
    }
    cout << "Yes\n";
    for (long long i = 1; i <= n; i++) {
      cout << color[i] << " ";
    }
  }
  return 0;
}
