Đếm #3

View as PDF

Submit solution

Points: 100.00 (partial)
Time limit: 1.0s
Memory limit: 102M
Input: stdin
Output: stdout

Author:
Problem type

Cho dãy số gồm ~N~ phần tử. Giá trị tuyệt đối của các phần tử trong dãy không quá ~X~. Cần phải thêm ít nhất bao nhiêu số (~\leq X~) để tổng tất cả các phần tử bằng 0.

Input
  • Dòng 1 nhập số nguyên dương ~N~ và ~X~ (~1 \leq N \leq 10^5, 1 \leq X \leq 10^9~).
  • Dòng 2 nhập ~N~ số nguyên ~A_i~ (~1 \leq i \leq N, |A_i| \leq 10^9~).
Output
  • In ra kết quả theo yêu cầu đề bài.
Example

Input

3 2
-1 1 2

Output

1

Comments

Please read the guidelines before commenting.


There are no comments at the moment.