#P8550. Safe Addition Sequence
Safe Addition Sequence
Safe Addition Sequence
You are given n numbers \(a_1, a_2, \ldots, a_n\) and a nonzero number \(x\). You are required to perform \(10^{100}\) operations. In each operation, you must choose an index \(i\) (\(1 \le i \le n\)) and add \(a_i\) to \(x\). After every operation, the resulting value of \(x\) must not be \(0\).
Determine whether it is possible to choose indices in each operation such that, after each addition, \(x \neq 0\) holds.
Note: The operations must be performed consecutively for \(10^{100}\) times. The answer is Yes
if it is possible, and No
otherwise.
inputFormat
The first line contains two space-separated integers: n
and x
, where \(x\) is nonzero.
The second line contains n
space-separated integers \(a_1, a_2, \ldots, a_n\).
outputFormat
Output a single line containing Yes
if it is possible to perform all \(10^{100}\) operations without \(x\) ever becoming \(0\). Otherwise, output No
.
sample
2 5
-5 10
Yes
</p>