#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, k;
vector<int> gr[1 + N];
int depth[2][1 + N];
int nr;
int maxleaf, mx;
int ans[1 + N];
void dfs(int node, int dad) {
  for (auto son : gr[node]) {
    if (son != dad) {
      depth[nr][son] = depth[nr][node] + 1;
      if (depth[nr][son] > mx) {
        mx = depth[nr][son];
        maxleaf = son;
      }
      dfs(son, node);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  maxleaf = mx = 0;
  nr = 0;
  dfs(1, -1);
  memset(depth, 0, sizeof(depth));
  int x = maxleaf;
  nr = 0;
  mx = 0;
  dfs(x, -1);
  int y = maxleaf;
  mx = 1;
  nr = 1;
  dfs(y, -1);
  for (int i = 1; i <= n; i++)
    if (depth[0][i] + 1 >= k && depth[1][i] + 1 >= k && k > 2 &&
        depth[0][i] + depth[1][i] != depth[0][y]) {
      cout << "No\n";
      return 0;
    }
  for (int i = 1; i <= n; i++)
    if (depth[0][i] > depth[1][i])
      ans[i] = depth[0][i] % k + 1;
    else
      ans[i] = ((depth[0][y] - depth[1][i]) % k + k) % k + 1;
  cout << "Yes\n";
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
