{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"MD","content":"Berland的巴士都配备了视频监控系统。 该系统记录有关停止后公交车上乘客人数变化的信息。\n\n如果 $x$ 是当前公共汽车站之前的公共汽车上的乘客人数,并且 $y$ 是当前公共汽车站之后的公共汽车上的乘客人数,则系统会记录 $y-x$ 。 因此,系统记录显示了乘客人数的变化。\n\n测试是针对单巴士站和n个巴士站进行的。 因此,系统记录了整数a1,a2,…,an(每个公交车站都一个数)的序列,其中ai是公交车站i的记录。 公交车站按时间顺序从1到n编号。\n\n如果公交车的容量等于w(即在公交车的任何时间,载客量应从0到w),请确定在第一个公交车站前有多少种不同的人数可以乘坐公交车。"}},{"title":"Input","value":{"format":"MD","content":"第一行包含两个整数n和w (1 ≤ n ≤ 1000,1 ≤ w ≤ 10 ^ 9) —公交车站的数量和容量 总线。\n\n第二行包含一个序列 a1,a2,... ,an (-10 ^ 6≤ ai≤ 10 ^ {6}),其中 ai 等于在 i th个公共汽车站后系统记录的数字。"}},{"title":"Output","value":{"format":"MD","content":"\u003cp\u003e251/5000\n如果公交车的容量等于w,则打印出第一个公交车站之前公交车可容纳多少人的可能方式。 如果情况是矛盾的(即对于任何最初的乘客数量,都会有矛盾),请打印\u003cspan class\u003d\"tex-font-style-tt\"\u003e0\u003c/span\u003e。\u003c/p\u003e"}},{"title":"Examples","value":{"format":"MD","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e3 5\u003cbr\u003e2 1 -3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e2 4\u003cbr\u003e-1 1\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e4\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e4 10\u003cbr\u003e2 4 1 2\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e2\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"MD","content":""}}]}