# @param int s start edge number
# @param Edge e the graph
# @param int k the number of colors
def bfs(s,e,k)
	# --- setup ---
	mod = 10**9+7
	childs = Array.new(E.size){0}
	# --- initial calc ---
	childs[s] = 0
	comb = k
	# --- initial next ---
	# queue format : [node, parent node, level]
	q = []
	e[s].each{|a| # must be `each`, not `map`
		q << [a,s,1]
	}
	while(!q.empty?)
		# p q
		v,v_p,lev = q.shift
		# p [v,v_p,lev]
		# --- calc ---
		# when no color can be allocated
		return 0 if ((k-[lev,2].min-childs[v_p])<=0)
		# calc
		comb *= (k-[lev,2].min-childs[v_p])
		comb %= mod
		childs[v_p] += 1		
		# --- next ---
		v_nxt = e[v].each{|i| 
			q << [i,v,lev+1] if (i != v_p)
		}
		# p comb
	end
	return comb
end
N,K=gets.chomp.split(' ').map{|n| n.to_i}
E = Array.new(N){[]}
1.upto(N-1){
	p=gets.chomp.split(' ').map{|n| n.to_i}
	p[0] -= 1
	p[1] -= 1
	E[p[0]].push(p[1])
	E[p[1]].push(p[0])
}
puts bfs(0,E,K)
