MOD = 10**9+7

def fact(n)
  @facts ||= [1]
  (@facts.size).upto(n){|i| @facts << @facts[-1]*i % MOD}
  return @facts[n]
end

def modpow(x,n)
  ret = 1
  while n > 0
    ret = (ret * x) % MOD if n&1 == 1
    x = (x*x) % MOD
    n >>= 1
  end
  return ret
end

def modinv(x)
  return modpow(x,MOD-2)
end

N,K = gets.split.map(&:to_i)
G = Array.new(N){[]}
size = [0]*N
(N-1).times do |i|
  a,b = gets.split.map(&:to_i)
  a,b = a-1,b-1
  G[a] << b
  G[b] << a
  size[a] += 1
  size[b] += 1
end

visited = [false]*N

visited[0] = true
ans = K * fact(K-1) * modinv(fact(K-1-size[0])) % MOD
q = G[0].dup

while v = q.shift
  if !visited[v]
    G[v].each do |u|
      q << u
    end

    if K < size[v]+1
      ans = 0
    else
      ans = ans * fact(K-2) * modinv(fact(K-1-size[v])) % MOD
    end
    visited[v] = true
  end
end
p ans