#ARC149D. [ARC149D] Simultaneous Sugoroku

[ARC149D] Simultaneous Sugoroku

Score : 700700 points

Problem Statement

There are NN pieces placed at integer coordinates on a number line. The coordinate of the ii-th piece is XiX_i.

Let us move these pieces MM times as follows.

  • In the ii-th move, given a positive integer DiD_i, we move each piece as follows.- A piece whose coordinate is a negative integer is moved a distance of DiD_i in the positive direction.
    • A piece whose coordinate is 00 is not moved.
    • A piece whose coordinate is a positive integer is moved a distance of DiD_i in the negative direction.
  • A piece whose coordinate is a negative integer is moved a distance of DiD_i in the positive direction.
  • A piece whose coordinate is 00 is not moved.
  • A piece whose coordinate is a positive integer is moved a distance of DiD_i in the negative direction.

Determine whether each piece arrives at the origin. If it does, print the number of moves after which it arrives there for the first time. Otherwise, print its coordinate after the MM moves.

Constraints

  • 1N3×1051\leq N\leq 3\times 10^5
  • 1M3×1051\leq M\leq 3\times 10^5
  • 1X1<<XN1061\leq X_1 < \cdots < X_N \leq 10^6
  • 1Di1061\leq D_i \leq 10^6

Input

The input is given from Standard Input in the following format:

NN MM

X1X_1 \ldots XNX_N

D1D_1 \ldots DMD_M

Output

Print NN lines. The ii-th line should describe the ii-th piece in the following format.

If the piece arrives at the origin, let xx be the number of moves after which it arrives there for the first time, and print the following:

Yes xx

If the piece does not arrive at the origin, let xx be its coordinate after the MM moves, and print the following:

No xx

6 4
2 4 6 8 10 12
8 2 5 7
No -6
No -4
Yes 2
Yes 1
Yes 2
No 4

The coordinate of each piece changes as follows.

  • The 11-st piece: $\phantom{0}2\quad \longmapsto \quad -6\quad \longmapsto \quad -4\quad \longmapsto \quad \phantom{-}1 \quad \longmapsto \quad -6$.
  • The 22-nd piece: $\phantom{0}4 \quad \longmapsto \quad -4\quad \longmapsto \quad -2 \quad \longmapsto \quad \phantom{-}3 \quad \longmapsto \quad -4$.
  • The 33-rd piece: $\phantom{0}6 \quad \longmapsto \quad -2\quad \longmapsto \quad \phantom{-}0 \quad \longmapsto \quad \phantom{-}0 \quad \longmapsto \quad \phantom{-}0$.
  • The 44-th piece: $\phantom{0}8 \quad \longmapsto \quad \phantom{-}0\quad \longmapsto \quad \phantom{-}0 \quad \longmapsto \quad \phantom{-}0 \quad \longmapsto \quad \phantom{-}0$.
  • The 55-th piece: $10 \quad \longmapsto \quad \phantom{-}2\quad \longmapsto \quad \phantom{-}0 \quad \longmapsto \quad \phantom{-}0 \quad \longmapsto \quad \phantom{-}0$.
  • The 66-th piece: $12 \quad \longmapsto \quad \phantom{-}4\quad \longmapsto \quad \phantom{-}2 \quad \longmapsto \quad -3 \quad \longmapsto \quad \phantom{-}4$.