|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||128 MB||6||5||2||100.000%|
As a part of a new advertising campaign, a big company in Gdynia wants to put its logo somewhere in the city. The company is going to spend the whole advertising budget for this year on the logo, so it has to be really huge. One of the managers decided to use whole buildings as parts of the logo.
The logo consists of n vertical stripes of different heights. The stripes are numbered from 1 to n from left to right. The logo is described by a permutation (s1, s2, . . . , sn) of numbers 1, 2, . . . , n. The stripe number s1 is the shortest one, the stripe number s2 is the second shortest etc., finally the stripe sn is the tallest one. The actual heights of the stripes do not really matter.
There are m buildings along the main street in Gdynia. To your surprise, the heights of the buildings are distinct. The problem is to find all positions where the logo matches the buildings.
Help the company and find all contiguous parts of the sequence of buildings which match the logo. A contiguous sequence of buildings matches the logo if the building number s1 within this sequence is the shortest one, the building number s2 is the second shortest, etc. For example a sequence of buildings of heights 5, 10, 4 matches a logo described by a permutation (3, 1, 2), since the building number 3 (of height 4) is the shortest one, the building number 1 is the second shortest and the building number 2 is the tallest.
The first line of the standard input contains two integers n and m (2 ≤ n ≤ m ≤ 1 000 000). The second line contains n integers si, forming a permutation of the numbers 1, 2, . . . , n. That is, 1 ≤ si ≤ n and si ≠ sj for i ≠ j. The third line contains m integers hi — the heights of the buildings (1 ≤ hi ≤ 109 for 1 ≤ i ≤ m). All the numbers hi are different. In each line the integers are separated by single spaces.
The first line of the standard output should contain an integer k, the number of matches. The second line should contain k integers — 1-based indices of buildings which correspond to the stripe number 1 from the logo in a proper match. The numbers should be listed in an increasing order and separated by single spaces. If k = 0, your program should print an empty second line.
5 10 2 1 5 3 4 5 6 3 8 12 7 1 10 11 9
2 2 6
Both the sequences 6, 3, 8, 12, 7 and 7, 1, 10, 11, 9 match the logo described by the permutation (2, 1, 5, 3, 4). In particular, in the first sequence the building number 2 (of height 3) is the shortest one, the building number 1 (of height 6) is the second shortest, the building number 5 (of height 7) is the third shortest, and so on.