Counting on Tree#431

Counting on Tree

1 second
122.174 megabytes
Very easy

You are given a tree with nodes. Each node has an associated value a_i (0 \leq a_i \leq 1).

A set of nodes is called beautiful if it satisfies the following conditions:

You need to count the number of beautiful sets. As this number may be large, print the answer modulo 10^9 + 7.

Input

The first line contains the number of tests . Each test consists of the following lines:

  • The first line contains two integers (1 \leq n \leq 50000) and (1 \leq k \leq 100).

  • The second line contains integers a_1, a_2, \ldots, a_n.

  • Each of the next n - 1 lines contains two integers and (1 \leq u, v \leq n) meaning there is an edge between and . It is guaranteed that these edges form a tree.

Output

For each test, print the answer on a separate line.

Examples

Example 1

Loading
Loading