### Path

Time Limit: 4000/2000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

#### Problem Description

Check if there exists a path of length $$l$$ in the given tree with weight assigned to each edges.

#### Input

The first line contains two integers $$n$$ and $$q$$, which denote the number of nodes and queries, repectively.

The following $$(n - 1)$$ with three integers $$a_i, b_i, c_i$$, which denote the edge between $$a_i$$ and $$b_i$$, with weight $$c_i$$.

Note that the nodes are labled by $$1, 2, \ldots, n$$.

The last line contains $$q$$ integers $$l_1, l_2, \ldots, l_q$$, denote the queries.

$$(1 \leq n, q \leq 10^5, 1 \leq c_i \leq 2)$$

#### Output

For each query, print the result in seperated line. If there exists path of given length, print "Yes". Otherwise, print "No".

#### Sample Input

4 6
1 2 2
2 3 1
3 4 2
0 1 2 3 4 5

#### Sample Output

Yes
Yes
Yes
Yes
No
Yes

ftiasch

#### Manager

Information
 Solved Number 40 Submit Number 153
Problem Tags
dfs and similar
dp
No tag edit access