

Time Limit: 2 sec / Memory Limit: 1024 MiB
問題文
1 から N の番号がついた N 個の荷物があります。荷物 i の大きさは A_i です。
1 から M の番号がついた M 個の箱が番号順に一列に並んでいます。最も左に箱 1 があり、最も右に箱 M があります。
箱 i の大きさは B_i です。
それぞれの箱には、荷物の大きさの合計が箱の大きさ以下である限り、何個でも荷物を入れることができます。
高橋君は番号の小さな荷物から順に、以下のルールで荷物を箱に入れます。
- まだ荷物を入れることができる箱のうち、最も左にある箱に荷物を入れる
全ての荷物を箱に入れることが可能かどうか判定してください。
さらに、可能な場合は、全ての荷物を箱に入れた状態で各箱に入っている荷物の大きさの合計を求め、不可能な場合は、箱に入れることができない荷物の番号の最小値を求めてください。
制約
- 1 \leq N \leq 2\times 10^5
- 1 \leq M \leq 2\times 10^5
- 1 \leq A_i,B_i \leq 10^9
- 入力は全て整数である
入力
入力は以下の形式で標準入力から与えられる。
N M A_1 A_2 \ldots A_N B_1 B_2 \ldots B_M
出力
全ての荷物を箱に入れることが可能なとき:
1 行目に Yes
と出力せよ。
2 行目には、全ての荷物を箱に入れた状態で箱 i に入っている荷物の大きさの合計を C_i としたとき、C_1,C_2,\ldots,C_M をこの順に空白区切りで出力せよ。
全ての荷物を箱に入れることが不可能なとき:
1 行目に No
と出力せよ。
2 行目には、箱に入れることができない荷物の番号の最小値を出力せよ。
入力例 1
3 3 4 7 3 10 4 8
出力例 1
Yes 7 0 7
高橋君は次のように行動します。
- 荷物 1 は箱 1,2,3 に入れることができるので、最も左にある箱 1 に入れる。
- 荷物 2 は箱 3 に入れることができるので、箱 3 に入れる。
- 荷物 3 は箱 1,2 に入れることができるので、最も左にある箱 1 に入れる。
荷物 2 を箱に入れようとする時点では、荷物 1 が箱 1 に入っているため、荷物 2 を箱 1 に入れることはできません。
全ての荷物を箱に入れた状態で各箱に入っている荷物の大きさの合計は
- 箱 1 には荷物 1,3 が入っており 3+4=7
- 箱 2 には荷物が入っておらず 0
- 箱 3 には荷物 2 が入っており 7
となります。
入力例 2
3 2 4 7 3 10 4
出力例 2
No 2
高橋君は次のように行動します。
- 荷物 1 は箱 1,2 に入れることができるので、最も左にある箱 1 に入れる。
- 荷物 2 を入れることができる箱は存在しない。
入力例 3
5 5 5 4 3 2 1 1 2 3 4 5
出力例 3
Yes 1 2 3 4 5
Problem Statement
We have N parcels numbered 1 to N. Parcel i has a size of A_i.
There are M boxes numbered 1 to M arranged in a row in numerical order: box 1 is the leftmost, and box M is the rightmost.
Box i has a size of B_i.
Each box can contain any number of parcels as long as the total size of the parcels is not greater than the size of the box.
For each parcel in the order from parcel 1 to parcel N, Takahashi will try to do the following:
- put the parcel into the leftmost box that can contain it.
Determine whether Takahashi can put all parcels into boxes.
Additionally, if he can, find the total size of parcels in each box after putting all parcels into boxes; otherwise, find the smallest number of a parcel that he cannot put into a box.
Constraints
- 1 \leq N \leq 2\times 10^5
- 1 \leq M \leq 2\times 10^5
- 1 \leq A_i,B_i \leq 10^9
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
N M A_1 A_2 \ldots A_N B_1 B_2 \ldots B_M
Output
If Takahashi can put all parcels into boxes:
The first line should contain Yes
.
The second line should contain C_1,C_2,\ldots,C_M with spaces in between, where C_i is the total size of the parcels in box i after putting all parcels into boxes.
If Takahashi cannot put all parcels into boxes:
The first line should contain No
.
The second line should contain the smallest number of a parcel that he cannot put into a box.
Sample Input 1
3 3 4 7 3 10 4 8
Sample Output 1
Yes 7 0 7
Takahashi will do the following.
- Parcel 1 can be put into box 1, 2, or 3. He puts it into the leftmost of them, box 1.
- Parcel 2 can be put into box 3. He puts it into this box.
- Parcel 3 can be put into box 1 or 2. He puts it into the leftmost of them, box 1.
Note that when he tries to put parcel 2, parcel 1 is already in box 1, so parcel 2 cannot be put into this box.
When all parcels are in boxes,
- box 1 contains parcels 1 and 3, for a total size of 3+4=7,
- box 2 contains no parcels, for a total size of 0, and
- box 3 contains parcel 2, for a total size of 7.
Sample Input 2
3 2 4 7 3 10 4
Sample Output 2
No 2
Takahashi will do the following.
- Parcel 1 can be put into box 1 or 2. He puts it into the leftmost of them, box 1.
- Parcel 2 cannot be put into any box.
Sample Input 3
5 5 5 4 3 2 1 1 2 3 4 5
Sample Output 3
Yes 1 2 3 4 5