#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long N = 2e5 + 100;
long long k;
vector<long long> g[N];
long long c[N];
vector<long long> d;
pair<long long, long long> farest(long long v, long long p1 = 0,
                                  long long p2 = 0) {
  pair<long long, long long> ans(0, v);
  for (long long to : g[v])
    if (to != p1 && to != p2) ans = max(ans, farest(to, v));
  ans.first++;
  return ans;
}
void col(long long v, long long add) {
  long long cur = (c[v] + add + k - 1) % k + 1;
  for (long long to : g[v])
    if (!c[to]) c[to] = cur, col(to, add);
}
bool diam(long long v, long long p, long long dest) {
  if (v == dest) return d.push_back(v), true;
  for (long long to : g[v])
    if (to != p && diam(to, v, dest)) return d.push_back(v), true;
  return false;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n >> k;
  for (long long i = 1; i <= n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  if (k == 2) {
    c[1] = 1;
    col(1, +1);
    cout << "Yes\n";
    for (long long i = 1; i <= n; i++) cout << c[i] << " ";
    exit(0);
  }
  long long v1 = farest(1).second;
  long long v2 = farest(v1).second;
  diam(v2, 0, v1);
  long long len = d.size();
  for (long long i = 0; i < len; i++) c[d[i]] = i % k + 1;
  for (long long i = 0; i < len; i++) {
    long long h =
        farest(d[i], (i > 0 ? d[i - 1] : 0), (i < len - 1 ? d[i + 1] : 0))
            .first;
    if (h == 1) continue;
    long long l = i + h;
    long long r = len - i - 1 + h;
    if (l >= k && r >= k) cout << "No", exit(0);
    if (l < k)
      col(d[i], -1);
    else
      col(d[i], +1);
  }
  cout << "Yes\n";
  for (long long i = 1; i <= n; i++) cout << c[i] << " ";
}
