#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-5;
const long double pi = acos(-1.0);
int n, k;
vector<int> G[1 << 18];
vector<int> dist;
int hantai(int s) {
  dist.clear();
  dist.resize(n, mod);
  dist[s] = 0;
  queue<int> q;
  q.push(s);
  int res;
  while (!q.empty()) {
    int id = q.front();
    q.pop();
    for (int j = 0; j < G[id].size(); j++) {
      int to = G[id][j];
      if (dist[id] + 1 < dist[to]) {
        dist[to] = dist[id] + 1;
        q.push(to);
      }
    }
    res = id;
  }
  return res;
}
int depth(int id, int fr) {
  int res = 0;
  for (int j = 0; j < G[id].size(); j++) {
    int to = G[id][j];
    if (to == fr) continue;
    res = max(res, depth(to, id));
  }
  return res + 1;
}
vector<int> ans(n);
void tocol(int id, int fr, int col, bool inc) {
  if (inc)
    col++;
  else
    col--;
  col = (col % k + k) % k;
  ans[id] = col;
  for (int j = 0; j < G[id].size(); j++) {
    int to = G[id][j];
    if (to == fr) continue;
    tocol(to, id, col, inc);
  }
}
void solve() {
  cin >> n >> k;
  ans.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  if (k == 2) {
    cout << "Yes" << endl;
    queue<int> q;
    q.push(0);
    vector<bool> used(n, false);
    used[0] = true;
    while (!q.empty()) {
      int id = q.front();
      q.pop();
      for (int j = 0; j < G[id].size(); j++) {
        int to = G[id][j];
        if (used[to]) continue;
        ans[to] = ans[id] ^ 1;
        used[to] = true;
        q.push(to);
      }
    }
    for (int i = 0; i < n; i++) {
      if (i > 0) cout << " ";
      cout << ans[i] + 1;
    }
    cout << endl;
    return;
  }
  int l = hantai(0);
  int r = hantai(l);
  int ma = dist[r];
  vector<int> ldist = dist;
  hantai(r);
  vector<int> &rdist = dist;
  int cur = l;
  vector<int> pathes;
  vector<bool> inpathes(n, false);
  while (cur != r) {
    inpathes[cur] = true;
    pathes.push_back(cur);
    for (int j = 0; j < G[cur].size(); j++) {
      int to = G[cur][j];
      if (inpathes[to]) continue;
      if (ma == ldist[to] + rdist[to]) {
        cur = to;
        break;
      }
    }
  }
  inpathes[r] = true;
  pathes.push_back(r);
  if (pathes.size() < k) {
    cout << "Yes" << endl;
    for (int i = 0; i < n; i++) {
      if (i > 0) cout << " ";
      cout << (i % k) + 1;
    }
    cout << endl;
    return;
  }
  for (int i = 0; i < pathes.size(); i++) {
    int col = i % k;
    int id = pathes[i];
    ans[id] = col;
    int dl = ldist[id], dr = rdist[id];
    int mal = 0;
    vector<int> szs;
    for (int j = 0; j < G[id].size(); j++) {
      int to = G[id][j];
      if (inpathes[to]) continue;
      int sz = depth(to, id);
      szs.push_back(sz);
    }
    sort(szs.begin(), szs.end(), greater<int>());
    if (szs.size() >= 2) {
      if (szs[0] + szs[1] + 1 >= k) {
        cout << "No" << endl;
        return;
      }
    }
    for (int j = 0; j < G[id].size(); j++) {
      int to = G[id][j];
      if (inpathes[to]) continue;
      int sz = depth(to, id);
      if (sz + dl + 1 >= k && sz + dr + 1 >= k) {
        cout << "No" << endl;
        return;
      }
      if (sz + dl + 1 >= k) {
        tocol(to, id, i % k, true);
      } else {
        tocol(to, id, i % k, false);
      }
    }
  }
  cout << "Yes" << endl;
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << ans[i] + 1;
  }
  cout << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
