#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> pin;

const int N = 2e5 + 5;
const ll P = 998244353LL;
const int inf = 1 << 30;

int n, k, tot, cnt, head[N], f[N];

struct Edge {
    int to, nxt;
} e[N << 1];

inline void add(int from, int to) {
    e[++tot].to = to;
    e[tot].nxt = head[from];
    head[from] = tot;
}

template <typename T>
inline void read(T &X) {
    char ch = 0; T op = 1; 
    for (X = 0; ch > '9' || ch < '0'; ch = getchar())
        if (ch == '-') op = -1;
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        X = (X * 10) + ch - '0';
    X *= op;
}

void dfs(int x, int fat, int mid) {
    int mx = -inf, mn = inf;
    for (int i = head[x]; i; i = e[i].nxt) {
        int y = e[i].to;
        if (y == fat) continue;
        dfs(y, x, mid);
        mx = max(mx, f[y]);
        mn = min(mn, f[y]);
    }
    if (mx == -inf) mx = 0;
    ++mn;
    // if (mn <= 0) {
    //     if (mn + mx > 0) {
    //         ++cnt;
    //         f[x] = -mid;
    //     } else f[x] = mn;    
    // } else {
    //     if (mx + 1 > mid) {
    //         ++cnt;
    //         f[x] = -mid;
    //     } else f[x] = mx + 1;
    // }
    if (mx + 1 > mid) {
        ++cnt;
        f[x] = -mid;
    } else if (mn + mx <= 0) f[x] = mn;
    else f[x] = mx + 1;
}

inline bool chk(int mid) {
    cnt = 0;
    for (int i = 1; i <= n; i++) f[i] = 0;
    dfs(1, 0, mid);
    if (f[1] > 0) ++cnt;
    // printf("%d:\n", mid);
    // for (int i = 1; i <= n; i++) printf("%d%c", f[i], " \n"[i == n]);
    return cnt <= k;
}

int main() {
// #ifndef ONLINE_JUDGE
//     freopen("sample.in", "r", stdin);
//     clock_t st_clock = clock();
// #endif

    read(n), read(k);
    for (int x, y, i = 1; i < n; i++) {
        read(x), read(y);
        add(x, y), add(y, x);
    }
    int l = 1, r = n, mid, res = n;
    for (; l <= r; ) {
        mid = (l + r) / 2;
        if (chk(mid)) res = mid, r = mid - 1;
        else l = mid + 1;
    }
    printf("%d\n", res);

// #ifndef ONLINE_JUDGE
//     clock_t ed_clock = clock();
//     printf("time = %f ms\n", (double)(ed_clock - st_clock) / CLOCKS_PER_SEC * 1000);
// #endif
    return 0;
}
#include<cstdio>//JZM YYDS!!!
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<ctime>
#define ll long long
#define MAXN 100005
#define uns unsigned
#define MOD 1000000007ll
#define INF 1e18
using namespace std;
inline ll read(){
	ll x=0;bool f=1;char s=getchar();
	while((s<'0'||s>'9')&&s>0){if(s=='-')f^=1;s=getchar();}
	while(s>='0'&&s<='9')x=(x<<1)+(x<<3)+s-'0',s=getchar();
	return f?x:-x;
}
inline ll ksm(ll a,ll b,ll mo){
	ll res=1;
	for(;b;b>>=1,a=a*a%mo)if(b&1)res=res*a%mo;
	return res;
}
ll n;
ll dp[MAXN];
vector<int>f;
stack<int>pt;
signed main()
{
	n=read();
	ll x=1,y=0;
	dp[0]=1;
	int m=0;
	for(m=1;m<=130;m++){
		y+=x,x+=y;
		dp[m]=x;
		if(dp[m]>n)break;
	}
	ll l=0;
	for(int i=m;i>=0;i--){
		if(l+dp[i]<=n)l+=dp[i],f.push_back(i);
		if(l+dp[i]<=n)l+=dp[i],f.push_back(i);
	}
	while(l<n)l+=dp[0],f.push_back(0);
	int w=0;
	for(int i=f.size()-1;i>=0;i--){
		int x=f[i];
		while(w<x)w++,pt.push(3),pt.push(4);
		pt.push(1);
	}
	printf("%d\n",(int)pt.size());
	while(!pt.empty())printf("%d\n",pt.top()),pt.pop();
	return 0;
}