#include using namespace std; int N, K; vector< int > graph[2000]; int dp[2000][2001]; int num[2000]; int rec(int idx, int prev) { for(int i = 0; i < graph[idx].size(); i++) { if(graph[idx][i] != prev) rec(graph[idx][i], idx); } dp[idx][0] = 1; num[idx] = 1; for(int i = 0; i < graph[idx].size(); i++) { if(graph[idx][i] == prev) continue; for(int j = num[idx]; j >= 0; j--) { for(int k = num[graph[idx][i]]; k >= 1; k--) { dp[idx][j + k] += dp[idx][j] * dp[graph[idx][i]][k]; } } num[idx] += num[graph[idx][i]]; } dp[idx][num[idx]] = 1; return(dp[idx][K]); } int main() { cin >> N >> K; for(int i = 0; i < N - 1; i++) { int a, b; cin >> a >> b; graph[a].push_back(b); graph[b].push_back(a); } cout << rec(0, -1) << endl; }