#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;
int n, k;
vector<int> g[N];
int mx, gag;
int answ[N];
int parent[N];
int dp[3][N];
void color(int v, int p, int r) {
  answ[v] = r + 1;
  for (int i = 0; i < (int)g[v].size(); i++) {
    int to = g[v][i];
    if (to == p) continue;
    color(to, v, r ^ 1);
  }
}
void dfs(int v, int p, int r, int id) {
  dp[id][v] = r;
  if (r > mx) {
    mx = r;
    gag = v;
  }
  for (int i = 0; i < (int)g[v].size(); i++) {
    int to = g[v][i];
    if (to == p) continue;
    parent[to] = v;
    dfs(to, v, r + 1, id);
  }
}
bool used[N];
void color(int v, int p, int guyn, int delta) {
  answ[v] = guyn;
  for (int i = 0; i < (int)g[v].size(); i++) {
    int to = g[v][i];
    if (to == p || used[to]) continue;
    int gg = guyn + delta;
    if (gg > k) gg -= k;
    if (gg < 1) gg += k;
    color(to, v, gg, delta);
  }
}
int main() {
  mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  if (k == 2) {
    color(1, -1, 0);
    cout << "Yes" << endl;
    for (int i = 1; i <= n; i++) {
      printf("%d ", answ[i]);
    }
    cout << endl;
    return 0;
  }
  dfs(1, -1, 0, 0);
  int s = gag;
  mx = -1;
  dfs(gag, -1, 0, 0);
  int e = gag;
  int it = 1;
  vector<int> path;
  while (e != s) {
    path.push_back(e);
    used[e] = true;
    answ[e] = it;
    it++;
    if (it > k) it -= k;
    e = parent[e];
  }
  path.push_back(s);
  used[s] = true;
  answ[s] = it;
  e = gag;
  dfs(gag, -1, 0, 1);
  for (int i = 1; i <= n; i++) {
    if (used[i]) continue;
    if (dp[0][i] >= k - 1 && dp[1][i] >= k - 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  for (int i = 0; i < (int)path.size() / 2; i++) {
    color(path[i], -1, answ[path[i]], -1);
  }
  for (int i = (int)path.size() / 2; i < (int)path.size(); i++) {
    color(path[i], -1, answ[path[i]], 1);
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", answ[i]);
  }
  cout << endl;
  return 0;
}
