{"trustable":true,"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\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eThe only difference between easy and hard versions is constraints.\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eIf you write a solution in Python, then prefer to send it in PyPy to speed up execution time.\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003cp\u003eA session has begun at Beland State University. Many students are taking exams.\u003c/p\u003e\u003cp\u003ePolygraph Poligrafovich is going to examine a group of $$$n$$$ students. Students will take the exam one-by-one in order from $$$1$$$-th to $$$n$$$-th. Rules of the exam are following:\u003c/p\u003e\u003cul\u003e \u003cli\u003e The $$$i$$$-th student randomly chooses a ticket. \u003c/li\u003e\u003cli\u003e if this ticket is too hard to the student, he doesn\u0027t answer and goes home immediately (this process is so fast that it\u0027s considered no time elapses). This student fails the exam. \u003c/li\u003e\u003cli\u003e if the student finds the ticket easy, he spends exactly $$$t_i$$$ minutes to pass the exam. After it, he immediately gets a mark and goes home. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eStudents take the exam in the fixed order, one-by-one, without any interruption. At any moment of time, Polygraph Poligrafovich takes the answer from one student.\u003c/p\u003e\u003cp\u003eThe duration of the whole exam for all students is $$$M$$$ minutes ($$$\\max t_i \\le M$$$), so students at the end of the list have a greater possibility to run out of time to pass the exam.\u003c/p\u003e\u003cp\u003eFor each student $$$i$$$, you should count the minimum possible number of students who need to fail the exam so the $$$i$$$-th student has enough time to \u003cspan class\u003d\"tex-font-style-bf\"\u003epass\u003c/span\u003e the exam.\u003c/p\u003e\u003cp\u003eFor each student $$$i$$$, find the answer independently. That is, if when finding the answer for the student $$$i_1$$$ some student $$$j$$$ should leave, then while finding the answer for $$$i_2$$$ ($$$i_2\u0026gt;i_1$$$) the student $$$j$$$ student does not have to go home.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains two integers $$$n$$$ and $$$M$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$, $$$1 \\le M \\le 2 \\cdot 10^7$$$)\u0026nbsp;— the number of students and the total duration of the exam in minutes, respectively.\u003c/p\u003e\u003cp\u003eThe second line of the input contains $$$n$$$ integers $$$t_i$$$ ($$$1 \\le t_i \\le 100$$$)\u0026nbsp;— time in minutes that $$$i$$$-th student spends to answer to a ticket.\u003c/p\u003e\u003cp\u003eIt\u0027s guaranteed that all values of $$$t_i$$$ are not greater than $$$M$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint $$$n$$$ numbers: the $$$i$$$-th number must be equal to the minimum number of students who have to leave the exam in order to $$$i$$$-th student has enough time to pass the exam.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e7 15\n1 2 3 4 5 6 7\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0 0 0 0 0 2 3 \u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5 100\n80 40 40 40 60\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0 1 1 2 3 \u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe explanation for the example 1.\u003c/p\u003e\u003cp\u003ePlease note that the sum of the first five exam times does not exceed $$$M\u003d15$$$ (the sum is $$$1+2+3+4+5\u003d15$$$). Thus, the first five students can pass the exam even if all the students before them also pass the exam. In other words, the first five numbers in the answer are $$$0$$$.\u003c/p\u003e\u003cp\u003eIn order for the $$$6$$$-th student to pass the exam, it is necessary that at least $$$2$$$ students must fail it before (for example, the $$$3$$$-rd and $$$4$$$-th, then the $$$6$$$-th will finish its exam in $$$1+2+5+6\u003d14$$$ minutes, which does not exceed $$$M$$$).\u003c/p\u003e\u003cp\u003eIn order for the $$$7$$$-th student to pass the exam, it is necessary that at least $$$3$$$ students must fail it before (for example, the $$$2$$$-nd, $$$5$$$-th and $$$6$$$-th, then the $$$7$$$-th will finish its exam in $$$1+3+4+7\u003d15$$$ minutes, which does not exceed $$$M$$$).\u003c/p\u003e"}}]}