J. Just Do it!
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

There is too much work to be done! The ICPC class now has an overwhelming amount of tasks that need to be handled. Each task requires a team of two people to complete. The ICPC class has $$$N$$$ people, and there are $$$M$$$ pairs of people who can work together (assigning incompatible pairs would cause awkwardness and complicate the tasks). Each pair can handle at most one task.

But if you think that means we can handle $$$M$$$ tasks, you are too naive! Each person also has their own workload limit. It is known that the $$$i$$$-th person is willing to handle at most $$$a_i$$$ tasks. This means that if the number of tasks assigned to the $$$i$$$-th person exceeds $$$a_i$$$, that person will refuse to do any work.

Can you help the ICPC class find the maximum number of task-handling pairs, such that no one exceeds their workload limit?

Input

The first line contains two positive integers $$$N$$$ and $$$M$$$, representing the number of people in the ICPC class and the number of pairs who can work together, respectively.

The second line contains $$$N$$$ integers $$$a_1, a_2, \ldots, a_N$$$, where $$$a_i$$$ represents the maximum number of tasks the $$$i$$$-th person is willing to handle.

The next $$$M$$$ lines each contain two integers $$$u_i$$$ and $$$v_i$$$, representing that the $$$u_i$$$-th person and the $$$v_i$$$-th person can work together. The pairs are numbered from $$$1$$$ to $$$m$$$.

  • $$$1 \leq N \leq 100$$$
  • $$$1 \leq M \leq 150$$$
  • $$$1 \leq a_i \leq M$$$
  • $$$1 \leq u_i \lt v_i \leq N$$$
  • $$$\forall i \lt j, (u_i, v_i) \neq (u_j, v_j)$$$
Output

The first line should output an integer $$$k$$$, representing the maximum number of task-handling pairs.

The second line should output $$$k$$$ integers $$$w_1, w_2, \ldots, w_k$$$ separated by single spaces, representing an optimal set of pairs that handled $$$k$$$ tasks, where $$$w_i$$$ represents the pair numbered $$$w_i$$$ in your optimal solution.

If there are multiple optimal solutions, any of them will be considered correct.

Examples
Input
4 4
2 1 3 4
1 2
1 3
2 3
3 4
Output
3
1 2 4
Input
6 8
2 2 3 2 3 1
1 2
1 3
1 5
3 5
3 4
4 5
4 6
5 6
Output
6
1 2 4 5 6 8