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

using namespace std;

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

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