The duck does not like the conditions.
The Great Duck enjoys solving problems but prefers concise conditions, so she asked me to keep it brief.
You have an array a
of length n
and a number k
. Each element in the array is either 1, −1, or 0. Your task is to replace all zeros with either −1 or 1 so that the sum of the array becomes positive and divisible by k.
Input Format
The first line contains two integers n and k (1 ≤ n, k ≤ 2 · 10^5
) — the number of elements in the array and the divisor for the sum.
The second line contains n integers a[1]
, a[2]
, ..., a[n]
(−1 ≤ a[i]
≤ 1) — the elements of the array.
Output Format
If it is possible to replace the zeros with −1 or 1 such that the sum of the array elements is positive and divisible by k
, print "Yes" (without quotes) on the first line, followed by n integers on the second line representing the modified array. If multiple solutions exist, you may print any of them.
If it is not possible, print "No" (without quotes) on one line.