#組み合わせ個数
def choose(n, r, mod)
  return 0 if not (0 <= r and r <= n)
  return 1 if r == 0 or r == n
  fact(n, mod) * inverse(fact(r, mod) * fact(n-r, mod) % mod, mod) % mod
end
#階乗(MODあり)
@fact = [1]
def fact(n, mod)
  if n > @fact.size then
    f = @fact[-1]
    (@fact.size+1..n).each{|i|
      f = (f * i) % mod
      @fact << f
    }
  end
  @fact[n-1]
end
#逆元(MODあり)
def inverse(x, mod)
  pow(x, mod-2, mod)
end
#べき乗(MODあり)(繰り返し２乗法)
def pow(x, n, mod)
  ans = 1
  while n > 0
    ans = ans * x % mod if n.odd?
    x = x * x % mod
    n >>= 1
  end
  ans
end

E = Hash.new{|h, k| h[k] = []}
MOD = 10 ** 9 + 7
N, K = gets.chomp.split(" ").map(&:to_i)
(N - 1).times{
  a, b = gets.chomp.split(" ").map(&:to_i)
  E[a] << b
  E[b] << a
}

q = []
done = Array.new(N + 1, false)
q.push([1, 0])
M = Hash.new{|h, k| h[k] = 0}
until(q.empty?) do
  a, d = q.pop
  done[a] = true
  m = 0
  E[a].each{|b|
    if !done[b] then
      q.push([b, d + 1])
      m += 1
    end
  }
  M[m] += 1 if d > 0
end

ans = choose(K, 1, MOD)
m = E[1].size
ans = (ans * choose(K - 1, m, MOD)) * fact(m, MOD) % MOD if m > 0
M.each{|k, v|
  next if k == 0
  ans = (ans * pow((choose(K - 2, k, MOD) * fact(k, MOD)) % MOD, v, MOD)) % MOD
}

puts ans
