#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
const int maxn = 1000005;
const int mod = 998244353;
const int inf = 1e9;
vector<int> adj[maxn];
pair<int, int> t[maxn];
int f[maxn], d[maxn], used[maxn];
struct BIT {
  vector<int> bit;
  BIT(int n) : bit(n + 1) {}
  void update(int i, int v) {
    while (i < bit.size()) {
      bit[i] += v;
      i += i & -i;
    }
  }
  int query(int i) {
    int sum = 0;
    while (i > 0) {
      sum += bit[i];
      i -= i & -i;
    }
    return sum;
  }
  int range(int i, int j) { return query(j) - query(i - 1); }
};
int cont = 1;
void dfs(int u) {
  t[u].first = cont++;
  for (int v : adj[u]) {
    if (v == f[u]) continue;
    f[v] = u;
    d[v] = d[u] + 1;
    dfs(v);
  }
  t[u].second = cont - 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  f[n] = 0;
  dfs(n);
  BIT b(maxn);
  for (int i = 1; i < n; i++) {
    b.update(t[i].first, d[i]);
    b.update(t[i].first + 1, -d[i]);
  }
  k = n - k;
  k--;
  int num = n - 1;
  used[n] = 1;
  while (k && num >= 1) {
    if (!used[num]) {
      int distancia = b.query(t[num].first);
      if (distancia <= k) {
        int curr = num;
        while (!used[curr]) {
          used[curr] = 1;
          b.update(t[curr].first, -1);
          b.update(t[curr].second + 1, 1);
          curr = f[curr];
          k--;
        }
      }
    }
    num--;
  }
  for (int i = 1; i <= n; i++) {
    if (!used[i]) cout << i << " ";
  }
  cout << '\n';
  return 0;
}
