CF2216A.Course Wishes

传统题 时间 2000 ms 内存 256 MiB 4 尝试 1 已通过 1 标签

Course Wishes

qwqkawaii is registering for nn (n50n\le 50) courses. In the registration system, he can submit a course wish for each course, which indicates his priority for taking that course.

Course wishes are divided into k+1k+1 (k20k\le 20) priority levels, where level 11 is the highest priority and level k+1k+1 is the lowest.

The first kk wish levels have capacity limits: for each 1ik1 \le i \le k, at most aia_i courses can be assigned wish level ii. Note that wish level k+1k+1 has no capacity limit.

Initially, the ii-th course has wish level bib_i, and it is guaranteed that this initial assignment satisfies all capacity limits. Now qwqkawaii wants to adjust all his courses to wish level k+1k + 1. To achieve this, he can apply the following operation at most 10001000 times:

  • Select a course ii (1in1\le i\le n), then increase bib_i by 11.

Note that:

  • A course at level k+1k+1 cannot be selected;
  • After every single operation, all capacity limits must still be satisfied.

Your task is to construct a valid adjustment sequence with at most 10001000 operations, or report that it is impossible.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t501 \le t \le 50). The description of the test cases follows.

The first line of each test case contains two integers nn and kk (1n501 \le n \le 50, 1k201 \le k \le 20) — the number of courses and the number of priority levels (excluding the lowest priority level).

The second line contains kk integers a1,a2,,aka_1, a_2, \ldots, a_k (1ain1 \le a_i \le n) — the capacity limits of the first kk wish levels.

The third line contains nn integers b1,b2,,bnb_1, b_2, \ldots, b_n (1bik+11 \le b_i \le k+1) — the initial wish levels of the courses.

It is guaranteed that the initial assignment satisfies all capacity limits.

Output

For each test case, if it is impossible to reach the target state, print a single integer 1-1.

Otherwise, print the number of operations mm (0m10000 \le m \le 1000) on the first line of output.

Then print one line with mm integers u1,u2,,umu_1, u_2, \ldots, u_m (1uin1 \le u_i \le n), denoting that in the ii-th operation, you increase the wish level buib_{u_i} of course uiu_i by 11.

Note

In the first test case, initially, the wish levels are [1,2,2][1, 2, 2]. The capacity limits are a1=2a_1=2 and a2=2a_2=2. The operations are as follows:

  1. Increase course 22 to level 33. Now the wish levels are [1,3,2][1,3,2].
  2. Increase course 11 to level 22. Now the wish levels are [2,3,2][2,3,2].
  3. Increase course 33 to level 33. Now the wish levels are [2,3,3][2,3,3].
  4. Increase course 11 to level 33. Now the wish levels are [3,3,3][3,3,3], which matches the target.

In the second test case, the initial state is already exactly the target state, so no operations are needed.

Samples

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

1
1 
8
2 4 1 2 1 1 5 4

在线编程 IDE

建议全屏模式获得最佳体验