#include <bits/stdc++.h>
using namespace std;
static inline int gi() {
  char ch = getchar();
  int x = 0;
  int op = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
  return x * op;
}
void _write(int a) {
  if (a >= 10) _write(a / 10);
  putchar(a % 10 + '0');
}
void pi(int a, char end = '\n') {
  if (a < 0) putchar('-'), a = -a;
  _write(a);
  putchar(end);
}
typedef struct Node {
  int color;
  vector<int> E;
  vector<int> P;
  void add(int i) { E.push_back(i); }
} Node;
typedef struct Graph {
  int n, l, painted;
  vector<Node> v;
  Graph(int size) : n(size), l(1), painted(0), v(size) {
    while ((1 << l) <= n) ++l;
    for (int i = 0; i < n; ++i) v[i].P.resize(l + 1, -1);
    for (int i = 0; i < n - 1; ++i) {
      int a = gi(), b = gi();
      add(a - 1, b - 1);
    }
  }
  void add(int a, int b) {
    v[a].add(b);
    v[b].add(a);
  }
  void dfs(int i = -1, int p = -1) {
    if (i == -1) i = n - 1;
    v[i].P[0] = p;
    for (int j = 1; j <= l; ++j)
      if (v[i].P[j - 1] != -1)
        v[i].P[j] = v[v[i].P[j - 1]].P[j - 1];
      else
        break;
    for (int j = 0; j < v[i].E.size(); ++j) {
      int to = v[i].E[j];
      if (to != p) dfs(to, i);
    }
  }
  int lookup(int a) {
    int res = v[a].color == 0;
    for (int i = l; i >= 0; --i) {
      int p = v[a].P[i];
      if (p > -1 && v[p].color == 0) {
        a = p;
        res += 1 << i;
      }
    }
    return res;
  }
  void paint(int a) {
    while (a > -1 && v[a].color == 0) {
      painted++;
      v[a].color = 1;
      a = v[a].P[0];
    }
  }
  void solve(int k) {
    int cur_try = n - 1;
    while (painted < n - k) {
      int cost = lookup(cur_try);
      if (painted + cost <= n - k) {
        paint(cur_try);
      }
      cur_try--;
    }
  }
  void print() {
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
      if (v[i].color == 0) {
        cnt++;
        if (cnt + painted < n) {
          pi(i + 1, ' ');
        } else {
          pi(i + 1, '\n');
        }
      }
    }
  }
} Graph;
int main() {
  int n = gi(), k = gi();
  Graph g(n);
  g.dfs();
  g.solve(k);
  g.print();
  return 0;
}
