import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.Map
import scala.collection.mutable.Queue
import scala.collection.mutable.PriorityQueue

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N, K = in.next().toInt
  val tree = Array.fill[List[Int]](N+1)(Nil)
  for (_ <- 1 until N) {
    val a, b = in.next().toInt
    tree(a) = b :: tree(a)
    tree(b) = a :: tree(b)
  }  


  //
  val MOD = 1e9.toInt + 7
  val mc = new ModComb(1e5.toInt, MOD)

  val dp = new Array[Boolean](N+1)

  def count(i: Int): Int = {
    var cnt = 1 + tree(i).length
    for (e <- tree(i))
      cnt += tree(e).length - 1

    cnt
  }

  val pq = new PriorityQueue[(Int, Int)]
  for (i <- 1 to N) {
    pq.enqueue((-count(i), i))
  }


  var ans = 1L
  breakable {
    while(!pq.isEmpty) {
      val (_cnt, i) = pq.dequeue()
      val cnt = -_cnt

      if (!dp(i)) {
        var yet = 1
        dp(i) = true
        for (e <- tree(i)) {
          if (!dp(e)) {
            yet += 1
            dp(e) = true
            for (e2 <- tree(e)) {
              if (!dp(e2)) {
                yet += 1
                dp(e2) = true
              }
            }
          }
        }

        if (yet > K) {
          ans = 0
          break
        }
        else {

          val n = K-(cnt-yet)
          if (yet < cnt)
            yet += 1
          ans *= mc.perm(n, yet)
          ans %= MOD
        }
      }
    }

  }

  println(ans)
}


class ModComb(maxNum: Int, mod: Long) {

  private def repeatSquares(x: Long, n: Long): Long = {
    if(n == 0)
      1
    else if(n % 2 == 0)
      repeatSquares(x*x % mod, n/2)
    else
      (x * repeatSquares(x*x % mod, n/2)) % mod
  }

  private val fact = new Array[Long](maxNum + 1)

  fact(0) = 1
  for (i <- 1 to maxNum)
    fact(i) = (i * fact(i-1)) % mod

  private val factInv = new Array[Long](maxNum + 1)

  factInv(maxNum) = repeatSquares(fact(maxNum), mod-2)
  for (i <- (1 to maxNum).reverse)
    factInv(i-1) = (i * factInv(i)) % mod


  // nPk
  def perm(n: Int, k: Int): Long = {
    (fact(n) * factInv(n-k)) % mod
  }


  // nCk
  def comb(n: Int, k: Int): Long = {
    val numer = fact(n)
    val denom = (factInv(n-k) * factInv(k)) % mod

    (numer * denom) % mod
  }

}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
