#include <bits/stdc++.h>
using namespace std;
void Max(int &x, int y) { x = max(x, y); }
void Min(int &x, int y) { x = min(x, y); }
const int N = 2e5 + 5;
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &a) {
  return os << '(' << a.first << ", " << a.second << ')';
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  os << '[';
  for (unsigned int i = 0; i < a.size(); i++)
    os << a[i] << (i < a.size() - 1 ? ", " : "");
  os << ']';
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const deque<T> &a) {
  os << '[';
  for (unsigned int i = 0; i < a.size(); i++)
    os << a[i] << (i < a.size() - 1 ? ", " : "");
  os << ']';
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &a) {
  os << '{';
  for (typename set<T>::iterator it = a.begin(); it != a.end(); it++) {
    typename set<T>::iterator jt = it;
    os << *it << (++jt != a.end() ? ", " : "");
  }
  os << '}';
  return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, map<T1, T2> &a) {
  os << "{\n";
  for (typename map<T1, T2>::iterator it = a.begin(); it != a.end(); it++) {
    typename map<T1, T2>::iterator jt = it;
    os << "  " << it->first << ": " << it->second
       << (++jt != a.end() ? ",\n" : "\n");
  }
  os << '}';
  return os;
}
int n, length;
vector<vector<int> > a(N);
int par[N];
int maxDepth[N];
void dfs(int u, int p, int depth, pair<int, int> &farthest) {
  par[u] = p;
  farthest = max(farthest, make_pair(depth + 1, u));
  for (auto v : a[u]) {
    if (v == p) continue;
    dfs(v, u, depth + 1, farthest);
  }
}
void pdfs(int u, int p) {
  maxDepth[u] = 1;
  for (auto v : a[u]) {
    if (v == p) continue;
    pdfs(v, u);
    maxDepth[u] = max(maxDepth[u], maxDepth[v] + 1);
  }
}
void checkdfs(int u, int p, int depth) {
  vector<pair<int, int> > ad;
  for (auto v : a[u]) {
    if (v == p) continue;
    ad.push_back(make_pair(maxDepth[v], v));
  }
  sort(ad.begin(), ad.end(), greater<pair<int, int> >());
  for (auto v : a[u]) {
    if (v == p) continue;
    if (v == ad.front().second) {
      int other = 0;
      if (ad.size() >= 2) other = ad[1].first;
      checkdfs(v, u, max(depth, other) + 1);
    } else {
      checkdfs(v, u, max(depth, ad.front().first) + 1);
    }
  }
  if (depth != 0) ad.push_back(make_pair(depth, 0));
  sort(ad.begin(), ad.end(), greater<pair<int, int> >());
  if (ad.size() >= 3) {
    if (ad[1].first + ad[2].first + 1 >= length) {
      cout << "No" << '\n';
      exit(0);
    }
  }
}
int color[N];
set<int> unused;
deque<int> dq;
void addFront(int u) {
  unused.erase(color[u]);
  dq.push_front(u);
};
void addBack(int u) {
  unused.erase(color[u]);
  dq.push_back(u);
};
void popFront() {
  unused.insert(color[dq.front()]);
  dq.pop_front();
};
int popBack() {
  int ret = dq.back();
  unused.insert(color[ret]);
  dq.pop_back();
  return ret;
};
void dfsColor(int u, int p) {
  int whPopBack = -1;
  assert(dq.size() <= length);
  if (dq.size() == length) whPopBack = popBack();
  color[u] = *unused.begin();
  addFront(u);
  for (auto v : a[u]) {
    if (v != p) dfsColor(v, u);
  }
  popFront();
  if (whPopBack != -1) addBack(whPopBack);
}
void solve(vector<int> arr) {
  int d = arr.size();
  memset(color, -1, sizeof(color));
  int tick = 0;
  for (auto &u : arr) {
    color[u] = tick;
    tick = (tick + 1) % length;
  }
  auto doColor = [&](int l, int r) {
    unused.clear();
    dq.clear();
    for (signed i = (0); i <= (length - 1); i++) unused.insert(i);
    int iter = min((int)arr.size() - 1, l + length - 1);
    for (signed i = (l); i <= (iter); i++) addBack(arr[i]);
    for (signed i = (l); i <= (r); i++) {
      if (i != l) {
        popFront();
        if (iter + 1 < arr.size()) iter++, addBack(arr[iter]);
      }
      for (auto v : a[arr[i]])
        if (color[v] == -1) dfsColor(v, arr[i]);
    }
  };
  doColor(0, (d + 1) / 2 - 1);
  reverse(arr.begin(), arr.end());
  doColor(0, (d + 1) / 2 - 1);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  memset(color, -1, sizeof(color));
  cin >> n >> length;
  for (signed i = (1); i <= (n - 1); i++) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(v);
    a[v].push_back(u);
  }
  pdfs(1, 1);
  if (length > 2) {
    checkdfs(1, 1, 0);
  }
  pair<int, int> farthest = make_pair(0, 1);
  dfs(1, 1, 0, farthest);
  int piv = farthest.second;
  farthest = make_pair(0, piv);
  dfs(piv, piv, 0, farthest);
  piv = farthest.second;
  vector<int> b;
  b.push_back(piv);
  while (par[piv] != piv) {
    piv = par[piv];
    b.push_back(piv);
  }
  solve(b);
  cout << "Yes" << '\n';
  for (signed i = (1); i <= (n); i++) {
    assert(color[i] != -1);
    cout << color[i] + 1 << ' ';
  }
  cout << '\n';
}
