macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      k: usize,
      ab: [(usize, usize); n-1]
   }
   let mut to = vec![vec![]; n];
   for (a, b) in ab {
      to[a - 1].push(b - 1);
      to[b - 1].push(a - 1);
   }
   let c = Comb::new(k);
   let ans = dfs(0, None, &c, k, &to);
   println!("{}", ans.x);
}

fn dfs(v: usize, p: Option<usize>, c: &Comb, k: usize, to: &Vec<Vec<usize>>) -> Mint {
   let mut x = match p {
      Some(_) => c.p(k - 2, to[v].len() - 1),
      None => c.p(k, to[v].len() + 1),
   };
   let p = match p {
      Some(x) => x,
      None => 0,
   };
   if x.x == -1 {
      Mint::new(0)
   } else {
      for &u in to[v].iter() {
         if p == u {
            continue;
         }
         x *= dfs(u, Some(v), c, k, to);
      }
      x
   }
}

use std::ops::*;
const MOD: i64 = 1000000007;
#[derive(Copy, Clone, Debug)]
pub struct Mint {
   x: i64,
}
impl Mint {
   fn new(x: i64) -> Self { Mint { x: x } }
   fn pow(self, n: usize) -> Self {
      let mut x = Mint::new(1);
      let mut r = self;
      let mut n = n;
      while n > 0 {
         if n & 1 == 1 {
            x *= r;
         }
         r *= r;
         n >>= 1;
      }
      x
   }
   fn inv(self) -> Self { self.pow((MOD - 2) as usize) }
}
impl AddAssign for Mint {
   fn add_assign(&mut self, rhs: Self) {
      self.x += rhs.x;
      self.x %= MOD;
   }
}
impl Add for Mint {
   type Output = Self;
   fn add(self, other: Self) -> Self {
      let mut res = self;
      res += other;
      res
   }
}
impl SubAssign for Mint {
   fn sub_assign(&mut self, rhs: Self) {
      self.x -= rhs.x;
      if self.x < 0 {
         self.x += MOD;
      }
   }
}
impl Sub for Mint {
   type Output = Self;
   fn sub(self, other: Self) -> Self {
      let mut res = self;
      res -= other;
      res
   }
}
impl MulAssign for Mint {
   fn mul_assign(&mut self, rhs: Self) {
      self.x *= rhs.x;
      self.x %= MOD;
   }
}
impl Mul for Mint {
   type Output = Self;
   fn mul(self, other: Self) -> Self {
      let mut res = self;
      res *= other;
      res
   }
}
impl DivAssign for Mint {
   fn div_assign(&mut self, rhs: Self) { *self *= rhs.inv(); }
}
impl Div for Mint {
   type Output = Self;
   fn div(self, other: Self) -> Self {
      let mut res = self;
      res *= other;
      res
   }
}
impl From<i64> for Mint {
   fn from(num: i64) -> Self { Mint { x: num } }
}
impl From<i32> for Mint {
   fn from(num: i32) -> Self { Mint { x: num as i64 } }
}
impl From<usize> for Mint {
   fn from(num: usize) -> Self { Mint { x: num as i64 } }
}

struct Comb {
   n: usize,
   fact: Vec<Mint>,
   ifact: Vec<Mint>,
}
impl Comb {
   fn new(n: usize) -> Self {
      let mut fact = vec![Mint::new(1); n + 1];
      let mut ifact = vec![Mint::new(1); n + 1];
      for i in 1..n + 1 {
         fact[i] = fact[i - 1] * Mint::from(i);
      }
      ifact[n] = fact[n as usize].inv();
      for i in (1..n + 1).rev() {
         ifact[i - 1] = ifact[i] * Mint::from(i);
      }
      Comb {
         n: n,
         fact: fact,
         ifact: ifact,
      }
   }
   fn p(&self, n: usize, r: usize) -> Mint {
      if r > n || n > self.n {
         Mint::new(-1)
      } else {
         self.fact[n] * self.ifact[n - r]
      }
   }
}


Measured memory_bytes: 19580