#include <fstream>
#include <vector>
#include <cassert>

using namespace std;

int n, d;
vector <vector <int> > to;

int getD (int a, int p, int b) {
  if (a == b) {
    return 0;
  }
  for (int i = 0; i < (int)to[a].size (); ++i) {
    int c = to[a][i];
    if (c == p) {
      continue;
    }
    int d = getD (c, a, b);
    if (d != -1) {
      return d + 1;
    }
  }
  return -1;
}

int main () {
  ifstream fin ("capitals.in");
  assert (fin >> n >> d);
  to.resize (n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    assert (fin >> a >> b);
    --a;
    --b;
    to[a].push_back (b);
    to[b].push_back (a);
  }
  fin.close ();
  int ans = 0;
  for (int a = 0; a < n; ++a) {
    for (int b = a + 1; b < n; ++b) {
      if (getD (a, -1, b) != d) {
        continue;
      }
      for (int c = b + 1; c < n; ++c) {
        if (getD (b, -1, c) == d && getD (c, -1, a) == d) {
          ++ans;
        }
      }
    }
  }
  ofstream fout ("capitals.out");
  fout << ans << endl;
  fout.close ();
  return 0;
}
