#include <bits/stdc++.h>
int main() {
  int N, K;
  scanf("%d%d", &N, &K);
  std::vector<int> head(1 + N), dst(2 + N * 2), nxt(2 + N * 2);
  for (int p = 0, i = 0; i < N - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    ++p;
    nxt[p] = head[u];
    head[u] = p;
    dst[p] = v;
    ++p;
    nxt[p] = head[v];
    head[v] = p;
    dst[p] = u;
  }
  int const ROOT = N;
  std::vector<int> visited(1 + N);
  std::vector<int> father(1 + N);
  std::queue<int> Q;
  Q.push(ROOT);
  father[ROOT] = 0;
  visited[ROOT] = true;
  while (!Q.empty()) {
    int x = Q.front();
    Q.pop();
    for (int h = head[x]; h != 0; h = nxt[h]) {
      int y = dst[h];
      if (!visited[y]) {
        father[y] = x;
        visited[y] = true;
        Q.push(y);
      }
    }
  }
  std::vector<std::array<int, 20> > parents(1 + N);
  for (int sh = 0; sh < 20; ++sh) parents[0][sh] = 0;
  for (int i = 1; i <= N; ++i) parents[i][0] = father[i];
  for (int sh = 1; sh < 20; ++sh) {
    for (int i = 1; i <= N; ++i) {
      parents[i][sh] = parents[parents[i][sh - 1]][sh - 1];
    }
  }
  std::vector<int> status(1 + N);
  int const total_saved = N - K;
  status[ROOT] = 1;
  int saved = 1;
  int n = ROOT;
  for (; K > 0;) {
    while (status[n] != 0) --n;
    assert(n > 0);
    int m = n, d = 0;
    for (int sh = 19; sh >= 0; --sh) {
      if (parents[m][sh] > 0 && status[parents[m][sh]] == 0) {
        m = parents[m][sh];
        d += 1 << sh;
      }
    }
    m = father[m];
    d = d + 1;
    if (saved + d <= total_saved) {
      int dn = 0;
      for (int x = n; x != m; x = father[x]) {
        ++dn;
        status[x] = 1;
      }
      assert(dn == d);
      saved += d;
    } else {
      Q.push(n);
      while (!Q.empty()) {
        int x = Q.front();
        Q.pop();
        assert(status[x] == 0);
        status[x] = 2;
        --K;
        for (int h = head[x]; h != 0; h = nxt[h]) {
          int y = dst[h];
          if (status[y] == 0 && y != father[x]) {
            Q.push(y);
          }
        }
      }
    }
  }
  for (int i = 1; i <= N; ++i) {
    if (status[i] == 2) printf("%d ", i);
  }
}
