#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 10;
vector<int> adj[maxN];
int n, k, a[maxN], h[maxN], parent[maxN], dp_down[maxN], dp_up[maxN];
bool vis[maxN];
vector<int> vc;
void last_dfs(int v, int par = -1) {
  vc.push_back(v);
  for (auto u : adj[v]) {
    if (u == par) continue;
    h[u] = h[v] + 1;
    last_dfs(u, v);
  }
}
void dfs_down(int v, int par = -1) {
  for (auto u : adj[v]) {
    if (u == par) continue;
    dfs_down(u, v);
    dp_down[v] = max(dp_down[v], dp_down[u] + 1);
  }
}
void dfs_up(int v, int par = -1) {
  int mx1 = 1 + dp_up[v], mx2 = 0;
  for (auto u : adj[v]) {
    if (u == par) continue;
    if (dp_down[u] + 2 > mx1)
      mx2 = mx1, mx1 = dp_down[u] + 2;
    else if (dp_down[u] + 2 > mx2)
      mx2 = dp_down[u] + 2;
  }
  for (auto u : adj[v]) {
    if (u == par) continue;
    if (2 + dp_down[u] == mx1)
      dp_up[u] = mx2;
    else
      dp_up[u] = mx1;
  }
  for (auto u : adj[v]) {
    if (u == par) continue;
    dfs_up(u, v);
  }
  mx1 = dp_up[v], mx2 = -1e9;
  int mx3 = -1e9;
  for (auto u : adj[v]) {
    if (u == par) continue;
    if (dp_down[u] + 1 > mx1)
      mx3 = mx2, mx2 = mx1, mx1 = dp_down[u] + 1;
    else if (dp_down[u] + 1 > mx2)
      mx3 = mx2, mx2 = dp_down[u] + 1;
    else if (dp_down[u] + 1 > mx3)
      mx3 = dp_down[u] + 1;
  }
  if (mx2 + mx3 >= k - 1) {
    cout << "No\n";
    exit(0);
  }
}
void DFS(int v, int par = -1) {
  parent[v] = par;
  for (auto u : adj[v]) {
    if (u == par) continue;
    h[u] = h[v] + 1;
    DFS(u, v);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  memset(h, 0, sizeof h);
  DFS(0);
  if (k <= 2) {
    cout << "Yes\n";
    for (int i = 0; i < n; i++) cout << (h[i] % 2) + 1 << ' ';
    cout << '\n';
    return 0;
  }
  int v1 = 0;
  for (int i = 0; i < n; i++)
    if (h[i] > h[v1]) v1 = i;
  memset(h, 0, sizeof h);
  DFS(v1);
  int v2 = 0;
  for (int i = 0; i < n; i++)
    if (h[i] > h[v2]) v2 = i;
  if (h[v2] + 1 < k) {
    cout << "Yes\n";
    for (int i = 0; i < n; i++) cout << 1 << ' ';
    cout << '\n';
    return 0;
  }
  vector<int> path;
  int curr = v2;
  while (true) {
    path.push_back(curr);
    if (curr == v1) break;
    curr = parent[curr];
  }
  memset(h, 0, sizeof h);
  int t = 0, len = path.size() - 1, l_len = 0;
  for (auto v : path) {
    vis[v] = true;
    a[v] = t % k;
    t++;
  }
  for (auto v : path) {
    for (auto u : adj[v]) {
      if (vis[u]) continue;
      vc.clear();
      h[u] = 0;
      last_dfs(u, v);
      int p = u;
      for (auto x : vc)
        if (h[x] > h[p]) p = x;
      int tool = h[p] + 1;
      if (tool + l_len >= k - 1 && tool + len - l_len >= k - 1)
        return cout << "No\n", 0;
      if (tool + l_len >= k - 1) {
        for (auto x : vc) a[x] = (l_len + h[x] + 1) % k;
      } else {
        for (auto x : vc) a[x] = (l_len - h[x] % k - 1 + 2 * k) % k;
      }
    }
    l_len++;
  }
  cout << "Yes\n";
  for (int i = 0; i < n; i++) cout << a[i] + 1 << ' ';
  cout << endl;
}
