N,K = gets.split.map &:to_i
es = {}
(N-1).times{
  a,b = gets.split.map &:to_i
  es[a] ||= {}; es[b] ||= {}
  es[a][b] = es[b][a] = 1
}

Visited = Array.new(N+1,false)

def dig(es, n, local_visited, depth=0)
  local_visited[n] = 1
  return { n => 1 } if depth == 2
  vs = {}
  es[n].keys.each{ |m|
    next if !Visited[m] || local_visited[m]
    vs[m] = 1
    dig(es, m, local_visited, depth+1).keys.each{ |o| vs[o] = 1}
  }
  vs
end

ans = 1
Mod = 10**9+7
queue = [1]
while queue.size > 0 do
  n = queue.pop
  ms = {}
  Visited[n] = true
  ds = dig(es, n, {})
  ans = (ans * [K-ds.size, 0].max) % Mod
  #p [n, ds, ans]
  es[n].keys.each{ |m| ms[m] = 1 if !Visited[m] }
  ms.keys.each{ |m| queue << m }
end

p ans