{"problem":{"name":"Simultaneous Sugoroku","description":{"content":"There are $N$ pieces placed at integer coordinates on a number line. The coordinate of the $i$\\-th piece is $X_i$. Let us move these pieces $M$ times as follows. *   In the $i$\\-th move, given a posi","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc149_d"},"statements":[{"statement_type":"Markdown","content":"There are $N$ pieces placed at integer coordinates on a number line. The coordinate of the $i$\\-th piece is $X_i$.\nLet us move these pieces $M$ times as follows.\n\n*   In the $i$\\-th move, given a positive integer $D_i$, we move each piece as follows.\n    *   A piece whose coordinate is a negative integer is moved a distance of $D_i$ in the positive direction.\n    *   A piece whose coordinate is $0$ is not moved.\n    *   A piece whose coordinate is a positive integer is moved a distance of $D_i$ in the negative direction.\n\nDetermine 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 $M$ moves.\n\n## Constraints\n\n*   $1\\leq N\\leq 3\\times 10^5$\n*   $1\\leq M\\leq 3\\times 10^5$\n*   $1\\leq X_1 < \\cdots < X_N \\leq 10^6$\n*   $1\\leq D_i \\leq 10^6$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n$X_1$ $\\ldots$ $X_N$\n$D_1$ $\\ldots$ $D_M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc149_d","tags":[],"sample_group":[["6 4\n2 4 6 8 10 12\n8 2 5 7","No -6\nNo -4\nYes 2\nYes 1\nYes 2\nNo 4\n\nThe coordinate of each piece changes as follows.\n\n*   The $1$\\-st piece: $\\phantom{0}2\\quad \\longmapsto \\quad -6\\quad \\longmapsto \\quad -4\\quad \\longmapsto \\quad \\phantom{-}1 \\quad \\longmapsto \\quad -6$.\n*   The $2$\\-nd piece: $\\phantom{0}4 \\quad \\longmapsto \\quad -4\\quad \\longmapsto \\quad -2 \\quad \\longmapsto \\quad \\phantom{-}3 \\quad \\longmapsto \\quad -4$.\n*   The $3$\\-rd piece: $\\phantom{0}6 \\quad \\longmapsto \\quad -2\\quad \\longmapsto \\quad \\phantom{-}0 \\quad \\longmapsto \\quad \\phantom{-}0 \\quad \\longmapsto \\quad \\phantom{-}0$.\n*   The $4$\\-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$.\n*   The $5$\\-th piece: $10 \\quad \\longmapsto \\quad \\phantom{-}2\\quad \\longmapsto \\quad \\phantom{-}0 \\quad \\longmapsto \\quad \\phantom{-}0 \\quad \\longmapsto \\quad \\phantom{-}0$.\n*   The $6$\\-th piece: $12 \\quad \\longmapsto \\quad \\phantom{-}4\\quad \\longmapsto \\quad \\phantom{-}2 \\quad \\longmapsto \\quad -3 \\quad \\longmapsto \\quad \\phantom{-}4$."]],"created_at":"2026-03-03 11:01:14"}}