var
i, j, k, n, d, u, v: longint;
c: int64;
a: array[1..5000, 1..5000] of longint;
function min(a, b: longint): longint;
begin
if a > b then a := b;
min := a;
end;
begin{
assign(input, 'capitals.in'); reset(input);
assign(output, 'capitals.out'); rewrite(output);}
read(n, d);
for i := 1 to n do
for j := 1 to n do a[i][j] := 1000000000;
for i := 1 to n - 1 do
begin
read(u, v);
a[u][v] := 1;
a[v][u] := 1;
end;
for k := 1 to n do
for i := 1 to n do
for j := 1 to n do
if i<>j then a[i][j] := min(a[i][j], a[i][k] + a[k][j]);
{
for i := 1 to n do
begin
for j := 1 to n do write(a[i][j], ' ');
writeln;
end; }
for k := 1 to n do
for i := 1 to n do
for j := 1 to n do
if (a[i][j] = d) and (a[i][k] = d) and (a[j][k] = d) then inc(c);
writeln(c / 6);
end.
dmFyCiAgaSwgaiwgaywgbiwgZCwgdSwgdjogbG9uZ2ludDsKICBjOiBpbnQ2NDsKICBhOiBhcnJheVsxLi41MDAwLCAxLi41MDAwXSBvZiBsb25naW50OwoKZnVuY3Rpb24gbWluKGEsIGI6IGxvbmdpbnQpOiBsb25naW50OwpiZWdpbgogIGlmIGEgPiBiIHRoZW4gYSA6PSBiOwogIG1pbiA6PSBhOwplbmQ7CgoKYmVnaW57CmFzc2lnbihpbnB1dCwgJ2NhcGl0YWxzLmluJyk7IHJlc2V0KGlucHV0KTsKYXNzaWduKG91dHB1dCwgJ2NhcGl0YWxzLm91dCcpOyByZXdyaXRlKG91dHB1dCk7fQogIHJlYWQobiwgZCk7CiAgZm9yIGkgOj0gMSB0byBuIGRvCiAgICBmb3IgaiA6PSAxIHRvIG4gZG8gYVtpXVtqXSA6PSAxMDAwMDAwMDAwOwogIAogIGZvciBpIDo9IDEgdG8gbiAtIDEgZG8KICBiZWdpbgogICAgcmVhZCh1LCB2KTsKICAgIGFbdV1bdl0gOj0gMTsKICAgIGFbdl1bdV0gOj0gMTsKICBlbmQ7CiAgCiAgZm9yIGsgOj0gMSB0byBuIGRvCiAgICBmb3Ig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