P11371 "CZOI-R2" Candy.

Description

There are $n$ children in a kindergarten. Initially, the $i$-th child has $a_i$ candies. The teacher can perform an unlimited number of operations. In each operation, she chooses one child and gives them $k$ candies. To prevent children from getting angry and eating other children's candies, the teacher wants all children to have the same number of candies. If the goal can be achieved, output `YES` and the minimum number of operations. If it cannot be achieved, output `NO` directly.

Input Format

The first line contains $2$ integers $n, k$, representing the number of children and the number of candies given in each operation. The second line contains $n$ integers $a_i$, representing the initial number of candies of the $i$-th child.

Output Format

Output `YES` or `NO` on the first line. If you output `YES`, then output $1$ integer on the next line, representing the answer.

Explanation/Hint

**Constraints** **This problem uses bundled testdata**. - Subtask #1 ($20\text{ pts}$): $n, k \le 10^3$, $a_i \le 10^3$. - Subtask #2 ($30\text{ pts}$): $k = 1$. - Subtask #3 ($50\text{ pts}$): no special constraints. For $100\%$ of the testdata, $1 \le n, k \le 10^5$, $0 \le a_i \le 2^{31} - 1$. Translated by ChatGPT 5