Codeforces Round 149 (Div. 2)
D
Dispute
Codeforces
2100
原题
← CE →
翻译中…

Valera has $*n*$ counters numbered from $1$ to $*n*$. Some of them are connected by wires, and each of the counters has a special button.

翻译中…

Initially, all the counters contain number $0$. When you press a button on a certain counter, the value it has increases by one. Also, the values recorded in all the counters, directly connected to it by a wire, increase by one.

翻译中…

Valera and Ignat started having a dispute, the dispute is as follows. Ignat thought of a sequence of $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. Valera should choose some set of distinct counters and press buttons on each of them exactly once (on other counters the buttons won't be pressed). If after that there is a counter with the number $*i*$, which has value $*a*_{*i*}$, then Valera loses the dispute, otherwise he wins the dispute.

翻译中…

Help Valera to determine on which counters he needs to press a button to win the dispute.

翻译中…

Input

翻译中…

The first line contains two space-separated integers $*n*$ and $*m*$ $(1 ≤ *n*, *m* ≤ 10^{5})$, that denote the number of counters Valera has and the number of pairs of counters connected by wires.

翻译中…

Each of the following $*m*$ lines contains two space-separated integers $*u*_{*i*}$ and $*v*_{*i*}$ $(1 ≤ *u*_{*i*}, *v*_{*i*} ≤ *n*, *u*_{*i*} ≠ *v*_{*i*})$, that mean that counters with numbers $*u*_{*i*}$ and $*v*_{*i*}$ are connected by a wire. It is guaranteed that each pair of connected counters occurs exactly once in the input.

翻译中…

The last line contains $*n*$ space-separated integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ $(0 ≤ *a*_{*i*} ≤ 10^{5})$, where $*a*_{*i*}$ is the value that Ignat choose for the $*i*$-th counter.

翻译中…

Output

翻译中…

If Valera can't win the dispute print in the first line -1.

翻译中…

Otherwise, print in the first line integer $*k*$ $(0 ≤ *k* ≤ *n*)$. In the second line print $*k*$ distinct space-separated integers — the numbers of the counters, where Valera should push buttons to win the dispute, in arbitrary order.

翻译中…

If there exists multiple answers, you are allowed to print any of them.

翻译中…

样例

Input #1
5 5
2 3
4 1
1 5
5 3
2 1
1 1 2 0 2
Output #1
2
1 2
InputCopy OutputCopy
Input #2
4 2
1 2
3 4
0 0 0 0
Output #2
3
1 3 4
InputCopy OutputCopy
题目信息
题号
242D
时间限制
2 s
内存限制
256 MB
标签
DFS 及类似
图论
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。