#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5;
vector<int> g[N];
int h[N];
multiset<int, greater<int>> S[N];
int get_max(multiset<int, greater<int>>& S) {
  if (S.empty()) return 0;
  return *S.begin();
}
int dfs_h(int v, int p) {
  for (int u : g[v]) {
    if (u == p) continue;
    S[v].insert(dfs_h(u, v) + 1);
  }
  return h[v] = get_max(S[v]);
}
bool dfs_check(int v, int p, int k) {
  if ((int)(S[v]).size() >= 3) {
    int a[3];
    int pos = 0;
    for (auto it = S[v].begin(); pos < 3; ++it, ++pos) a[pos] = *it;
    if (a[1] + a[2] >= k - 1) {
      return false;
    }
  }
  for (int u : g[v]) {
    if (u == p) continue;
    S[v].erase(S[v].find(h[u] + 1));
    h[v] = get_max(S[v]);
    S[u].insert(h[v] + 1);
    h[u] = get_max(S[u]);
    if (!dfs_check(u, v, k)) return false;
    S[u].erase(S[u].find(h[v] + 1));
    h[u] = get_max(S[u]);
    S[v].insert(h[u] + 1);
    h[v] = get_max(S[v]);
  }
  return true;
}
int find_far(int v, int n, vector<int>& path) {
  vector<int> dist(n, 0), par(n, v);
  function<void(int, int)> dfs_dist = [&](int v, int p) {
    for (int u : g[v]) {
      if (u != p) {
        par[u] = v;
        dist[u] = dist[v] + 1;
        dfs_dist(u, v);
      }
    }
  };
  dfs_dist(v, -1);
  int res = 0;
  for (int v = 1; v < n; ++v)
    if (dist[v] > dist[res]) res = v;
  path.clear();
  for (int u = res; u != v; u = par[u]) path.push_back(u);
  path.push_back(v);
  return res;
}
int find_diam(int n, vector<int>& diam) {
  int x = find_far(0, n, diam);
  int y = find_far(x, n, diam);
  return (int)(diam).size();
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u;
    --v;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  vector<int> c(n, -1);
  function<void(int, int, int)> dfs_color = [&](int v, int p, int step) {
    for (int u : g[v]) {
      if (u != p) {
        c[u] = (c[v] + step + k) % k;
        dfs_color(u, v, step);
      }
    }
  };
  if (k == 2) {
    c[0] = 0;
    dfs_color(0, -1, 1);
    printf("Yes\n");
    for (int i = 0; i < n; ++i) printf("%d ", c[i] + 1);
    printf("\n");
    return 0;
  }
  dfs_h(0, -1);
  if (!dfs_check(0, -1, k)) {
    printf("No\n");
    return 0;
  }
  printf("Yes\n");
  vector<int> diam;
  int d = find_diam(n, diam);
  int p = diam[d / 2 - 1], q = diam[d / 2];
  c[p] = 0;
  c[q] = 1;
  dfs_color(p, q, -1);
  dfs_color(q, p, 1);
  for (int i = 0; i < n; ++i) printf("%d ", c[i] + 1);
  printf("\n");
}
