#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<vector<int> > adjl;
int dan[500], niche[500], par[500];
int order[500];
int dp[500][3][500];
int indx[500][500];
int func(int u, bool is_in, int k_ase) {
  if (dp[u][is_in][k_ase] != -1) {
    return dp[u][is_in][k_ase];
  }
  if (k_ase == 0) {
    int ret = 0;
    if (par[u] != -1) {
      if (par[u] != 1) {
        ret += (adjl[par[u]].size() - 1) - order[u];
      } else {
        ret += (adjl[par[u]].size()) - order[u];
      }
    }
    return dp[u][is_in][k_ase] = ret;
  }
  if ((niche[u] == -1) && (dan[u] == -1) && (k_ase > 1)) {
    return dp[u][is_in][k_ase] = 100000000;
  }
  int sz = adjl[u].size();
  int ans = 100000000;
  if (is_in == 0) {
    for (int i = 0; i <= sz - 1; i++) {
      int v = adjl[u][i];
      if (v == par[u]) {
        continue;
      }
      ans = min(ans, func(v, is_in, k_ase));
    }
    if (niche[u] != -1) {
      int cc = 0;
      if (par[u] != -1) {
        cc = 1;
      }
      ans = min(ans, cc + func(niche[u], 1, k_ase - 1));
    } else if (k_ase == 1) {
      int cc = 0;
      if (par[u] != -1) {
        cc = 1;
      }
      ans = min(ans, cc);
    }
  } else {
    if (dan[u] != -1) {
      ans = min(ans, 1 + func(dan[u], is_in, k_ase));
    }
    int tmp_k_ase = k_ase - 1;
    if ((niche[u] != -1) && (dan[u] != -1)) {
      for (int i = 0; i <= tmp_k_ase; i++) {
        ans = min(
            ans, func(niche[u], is_in, i) + func(dan[u], is_in, tmp_k_ase - i));
      }
    } else if ((niche[u] != -1)) {
      ans = min(ans, func(niche[u], is_in, k_ase - 1));
    } else if ((dan[u] != -1)) {
      ans = min(ans, func(dan[u], is_in, k_ase - 1));
    } else if (k_ase == 1) {
      ans = min(ans, 0);
    }
  }
  return dp[u][is_in][k_ase] = ans;
}
void bt(int u, bool is_in, int k_ase) {
  if (k_ase == 0) {
    int ret = 0;
    if (par[u] != -1) {
      int si = par[u];
      for (int i = order[u]; i <= (int)(adjl[si].size() - 1); i++) {
        int v = adjl[si][i];
        if ((i == order[u]) && (v != u)) {
          continue;
        }
        if (v == par[si]) {
          continue;
        }
        cout << indx[si][v] << " ";
      }
    }
    return;
  }
  if ((niche[u] == -1) && (dan[u] == -1) && (k_ase > 1)) {
    return;
  }
  int sz = adjl[u].size();
  if (is_in == 0) {
    for (int i = 0; i <= sz - 1; i++) {
      int v = adjl[u][i];
      if (v == par[u]) {
        continue;
      }
      if (dp[u][is_in][k_ase] == dp[v][is_in][k_ase]) {
        bt(v, is_in, k_ase);
        return;
      }
    }
    if (niche[u] != -1) {
      int cc = 0;
      if (par[u] != -1) {
        cc = 1;
      }
      if (dp[u][is_in][k_ase] == cc + dp[niche[u]][1][k_ase - 1]) {
        if (cc) {
          cout << indx[u][par[u]] << " ";
        }
        bt(niche[u], 1, k_ase - 1);
        return;
      }
    } else if (k_ase == 1) {
      int cc = 0;
      if (par[u] != -1) {
        cc = 1;
      }
      if (dp[u][is_in][k_ase] == cc) {
        if (cc) {
          cout << indx[u][par[u]] << " ";
        }
        return;
      }
    }
  } else {
    if (dan[u] != -1) {
      if (dp[u][is_in][k_ase] == (1 + dp[dan[u]][is_in][k_ase])) {
        cout << indx[u][par[u]] << " ";
        bt(dan[u], is_in, k_ase);
        return;
      }
    }
    int tmp_k_ase = k_ase - 1;
    if ((niche[u] != -1) && (dan[u] != -1)) {
      for (int i = 0; i <= tmp_k_ase; i++) {
        if (dp[u][is_in][k_ase] ==
            (dp[niche[u]][is_in][i] + dp[dan[u]][is_in][tmp_k_ase - i])) {
          bt(niche[u], is_in, i);
          bt(dan[u], is_in, tmp_k_ase - i);
          return;
        }
      }
    } else if ((niche[u] != -1)) {
      if (dp[u][is_in][k_ase] == dp[niche[u]][is_in][k_ase - 1]) {
        bt(niche[u], is_in, k_ase - 1);
        return;
      }
    } else if ((dan[u] != -1)) {
      if (dp[u][is_in][k_ase] == dp[dan[u]][is_in][k_ase - 1]) {
        bt(dan[u], is_in, k_ase - 1);
        return;
      }
    } else if (k_ase == 1) {
      return;
    }
  }
}
void bfs(int u, int pp) {
  par[u] = pp;
  int sz = adjl[u].size();
  vector<int> nodes;
  for (int i = 0; i <= sz - 1; i++) {
    int v = adjl[u][i];
    if (v == pp) {
      continue;
    }
    nodes.push_back(v);
    bfs(v, u);
  }
  if (nodes.size()) {
    niche[u] = nodes[0];
    order[nodes[0]] = 0;
  }
  for (int i = 1; i <= (int)(nodes.size() - 1); i++) {
    dan[nodes[i - 1]] = nodes[i];
    order[nodes[i]] = i;
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  ;
  cin >> n >> k;
  adjl.resize(n + 1, vector<int>(0));
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adjl[u].push_back(v);
    adjl[v].push_back(u);
    indx[u][v] = i;
    indx[v][u] = i;
  }
  memset((dan), -1, sizeof(dan));
  memset((niche), -1, sizeof(niche));
  bfs(1, -1);
  memset((dp), -1, sizeof(dp));
  cout << func(1, 0, k) << "\n";
  bt(1, 0, k);
  return 0;
}
