#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long llinf = (1LL << 62);
const int inf = (1 << 30);
const int nmax = 2e5 + 50;
const long long mod = 1e9 + 7;
using namespace std;
int n, k, i, md, rs[nmax], mx, x, y, ap[nmax], viz[nmax], f, s, da[nmax],
    db[nmax];
vector<int> dm, vc, a[nmax];
queue<int> q;
void cll(int x, int p) {
  rs[x] = rs[p] ^ 1;
  for (int i = 0; i < (int)a[x].size(); i++) {
    int y = a[x][i];
    if (y == p) continue;
    cll(y, x);
  }
}
void dfs1(int x, int p, int d, int &cr) {
  if (d >= mx) {
    mx = d;
    cr = x;
  }
  for (int i = 0; i < (int)a[x].size(); i++) {
    int y = a[x][i];
    if (y == p) continue;
    dfs1(y, x, d + 1, cr);
  }
}
void dfs2(int x, int p) {
  vc.push_back(x);
  if (x == s) dm = vc;
  for (int i = 0; i < (int)a[x].size(); i++) {
    int y = a[x][i];
    if (y == p) continue;
    dfs2(y, x);
  }
  vc.pop_back();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (i = 1; i < n; i++) {
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  if (k == 2) {
    cll(1, 1);
    cout << "Yes" << endl;
    for (i = 1; i <= n; i++) cout << rs[i] + 1 << " ";
    cout << endl;
    return 0;
  }
  dfs1(1, 1, 1, f);
  dfs1(f, f, 1, s);
  if (mx < k) {
    cout << "Yes" << endl;
    for (i = 1; i <= n; i++) cout << 1 << " ";
    cout << endl;
    return 0;
  }
  dfs2(f, f);
  for (i = 0; i < mx; i++) ap[dm[i]] = 1;
  for (i = 1; i <= n; i++) da[i] = inf;
  da[dm[0]] = 1;
  q.push(dm[0]);
  while (!q.empty()) {
    x = q.front();
    q.pop();
    for (i = 0; i < (int)a[x].size(); i++) {
      y = a[x][i];
      if (da[y] != inf) continue;
      da[y] = da[x] + 1;
      q.push(y);
    }
  }
  for (i = 1; i <= n; i++) db[i] = inf;
  db[dm.back()] = 1;
  q.push(dm.back());
  while (!q.empty()) {
    x = q.front();
    q.pop();
    for (i = 0; i < (int)a[x].size(); i++) {
      y = a[x][i];
      if (db[y] != inf) continue;
      db[y] = db[x] + 1;
      q.push(y);
    }
  }
  for (i = 1; i <= n; i++)
    if (!ap[i] && da[i] >= k && db[i] >= k) return cout << "No" << endl, 0;
  md = (mx - 1) / 2;
  rs[dm[md]] = 1;
  viz[dm[md]] = 1;
  if (md) viz[dm[md - 1]] = 1;
  q.push(dm[md]);
  while (!q.empty()) {
    x = q.front();
    q.pop();
    for (i = 0; i < (int)a[x].size(); i++) {
      y = a[x][i];
      if (viz[y]) continue;
      rs[y] = rs[x] + 1;
      if (rs[y] == k + 1) rs[y] = 1;
      q.push(y);
      viz[y] = 1;
    }
  }
  for (i = 1; i <= n; i++) viz[i] = 0;
  rs[dm[md]] = 1;
  viz[dm[md]] = 1;
  if (md < mx - 1) viz[dm[md + 1]] = 1;
  q.push(dm[md]);
  while (!q.empty()) {
    x = q.front();
    q.pop();
    for (i = 0; i < (int)a[x].size(); i++) {
      y = a[x][i];
      if (viz[y]) continue;
      rs[y] = rs[x] - 1;
      if (rs[y] == 0) rs[y] = k;
      q.push(y);
      viz[y] = 1;
    }
  }
  cout << "Yes" << endl;
  for (i = 1; i <= n; i++) cout << rs[i] << " ";
  cout << endl;
  return 0;
}
