description: A tree is an undirected connected graph without cycles.
  
  You are given a tree of n vertices. Find the number of ways to choose exactly k vertices in this tree (i. e. a k-element subset of vertices) so that all pairwise distances between the selected vertices are equal (in other words, there exists an integer c such that for all u, v (u ≠ v, u, v are in selected vertices) d_{u,v}=c, where d_{u,v} is the distance from u to v).
  
  Since the answer may be very large, you need to output it modulo 10^9 + 7.
  
  Input
  
  The first line contains one integer t (1 ≤ t ≤ 10) — the number of test cases. Then t test cases follow.
  
  Each test case is preceded by an empty line.
  
  Each test case consists of several lines. The first line of the test case contains two integers n and k (2 ≤ k ≤ n ≤ 100) — the number of vertices in the tree and the number of vertices to be selected, respectively. Then n - 1 lines follow, each of them contains two integers u and v (1 ≤ u, v ≤ n, u ≠ v) which describe a pair of vertices connected by an edge. It is guaranteed that the given graph is a tree and has no loops or multiple edges.
  
  Output
  
  For each test case output in a separate line a single integer — the number of ways to select exactly k vertices so that for all pairs of selected vertices the distances between the vertices in the pairs are equal, modulo 10^9 + 7 (in other words, print the remainder when divided by 1000000007).
  
  Example
  
  Input
  
  
  3
  
  4 2
  1 2
  2 3
  2 4
  
  3 3
  1 2
  2 3
  
  5 3
  1 2
  2 3
  2 4
  4 5
  
  
  Output
  
  
  6
  0
  1
solution: 
  mod = 1000000007 
  
  # def power(x, m):
  #     if m == 0:
  #         return 1
  #     if m == 1:
  #         return x % mod
  #     if m % 2 == 1:
  #         return x * power(x, m - 1) % mod
  #     tmp = power(x, m // 2)
  #     return tmp * tmp % mod
  
  # def C(k, n):
  #     if k > n:
  #         return 0
  #     return gt[n] * pgt[k] % mod * pgt[n - k] % mod
  
  # def build():
  #     gt[0] = 1
  #     for i in range(1, 101):
  #         gt[i] = gt[i - 1] * i % mod
  #     pgt[100] = power(gt[100], mod - 2)
  #     for i in range(99, -1, -1):
  #         pgt[i] = pgt[i + 1] * (i + 1) % mod
  
  def min(x, y):
      if x < y:
          return x
      return y
  
  def solve(m, x):
      if m < k:
          return 0
      f = [[0 for _ in range(k + 1)] for _ in range(m + 1)]
      f[0][0] = 1
      # print(m, k, f[m][k], "ccccc")
      for i in range(1, m + 1):
          for j in range(0, min(k + 1, i + 1)):
              if j == 0:
                  f[i][j] = 1
              else:
                  f[i][j] = (f[i - 1][j] + cnt[i] * f[i - 1][j - 1] % mod) % mod
              # print(i, j)
      # print(f[m][k], "ccc", x)
      return f[m][k]
  
  def process(x):
      # print(x)
      check[x] = 1
      res = 0
      q = []
      for i in range(len(a[x])):
          v = a[x][i]
          check[v] = 1
          q.append([v, i + 1])
      # print(q)
      res = solve(len(a[x]), x)
      while len(q):
          cur = []
          for i in range(len(q)):
              u = q[i][0]
              j = q[i][1]
              cnt[j] -= 1
              for v in a[u]:
                  if check[v] == 0:
                      cur.append([v, j])
                      check[v] = 1
                      cnt[j] += 1
          # print(cur)
          q = cur
          res += solve(len(a[x]), x)
          # print(cnt[1:(len(a[x]) + 1)], x)
          res %= mod
      return res
  
  
  if __name__ == '__main__':
      test = int(input())
      # gt = [0 for _ in range(104)]
      # pgt = [0 for _ in range(104)]
      # build()
      for _ in range(test):
          input()
          n, k = map(int, input().split())
          a = [[] for _ in range(n + 1)]
          
          for _ in range(n - 1):
              x, y = map(int, input().split())
              a[x].append(y)
              a[y].append(x)
          
          ans = 0
  
          if k == 2:
              print(n * (n - 1) // 2)
              continue
          
          for x in range(1, n + 1):
              check = [0 for _ in range(n + 1)]
              cnt = [1 for _ in range(n + 1)]
              ans = (ans + process(x)) % mod
          
          print(ans)