#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}


#[derive(Eq, PartialEq, Clone, Debug)]
struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn dfs(i: usize, max_d: usize, e: &Vec<Vec<usize>>, visited: &mut Vec<bool>) -> usize {
    visited[i] = true;
    if max_d == 0 {
        1
    } else {
        let v: Vec<usize> = e[i].iter().filter(|&&t| !visited[t]).cloned().collect();
        1 +
            v.iter()
                .map(|&t| dfs(t, max_d - 1, e, visited))
                .sum::<usize>()
    }
}

fn main() {
    let (n, k) = get!(usize, usize);
    let e = get!(usize, usize; n-1);

    let mut g = vec![Vec::new(); n];

    for &(a, b) in &e {
        g[a - 1].push(b - 1);
        g[b - 1].push(a - 1);
    }

    if k % 2 == 0 {
        let ans = n -
            (0..n)
                .map(|i| {
                    let mut visited = vec![false; n];
                    visited[i] = true;
                    dfs(i, k / 2, &g, &mut visited)
                })
                .max()
                .unwrap();
        println!("{}", ans);
    } else {
        let ans = n -
            e.iter()
                .map(|&(a, b)| {
                    let mut visited = vec![false; n];
                    visited[a - 1] = true;
                    visited[b - 1] = true;
                    dfs(a - 1, k / 2, &g, &mut visited) + dfs(b - 1, k / 2, &g, &mut visited)
                })
                .max()
                .unwrap();
        println!("{}", ans);
    }
}


Measured memory_bytes: 4476