{"problem":{"name":"Partition","description":{"content":"You are given integers $N$ and $K$. The **cumulative sums** of an integer sequence $X=(X_1,X_2,\\dots ,X_N)$ of length $N$ is defined as a sequence $Y=(Y_0,Y_1,\\dots ,Y_N)$ of length $N+1$ as follows: ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc179_a"},"statements":[{"statement_type":"Markdown","content":"You are given integers $N$ and $K$.\nThe **cumulative sums** of an integer sequence $X=(X_1,X_2,\\dots ,X_N)$ of length $N$ is defined as a sequence $Y=(Y_0,Y_1,\\dots ,Y_N)$ of length $N+1$ as follows:\n\n*   $Y_0=0$\n*   $Y_i=\\displaystyle\\sum_{j=1}^{i}X_j\\ (i=1,2,\\dots ,N)$\n\nAn integer sequence $X=(X_1,X_2,\\dots ,X_N)$ of length $N$ is called a **good sequence** if and only if it satisfies the following condition:\n\n*   Any value in the cumulative sums of $X$ that is less than $K$ appears before any value that is not less than $K$.\n    *   Formally, for the cumulative sums $Y$ of $X$, for any pair of integers $(i,j)$ such that $0 \\le i,j \\le N$, if $(Y_i < K$ and $Y_j \\ge K)$, then $i < j$.\n\nYou are given an integer sequence $A=(A_1,A_2,\\dots ,A_N)$ of length $N$. Determine whether the elements of $A$ can be rearranged to a good sequence. If so, print one such rearrangement.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $-10^9 \\leq K \\leq 10^9$\n*   $-10^9 \\leq A_i \\leq 10^9$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $K$\n$A_1$ $A_2$ $\\cdots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc179_a","tags":[],"sample_group":[["4 1\n-1 2 -3 4","Yes\n-3 -1 2 4\n\nIf you rearrange $A$ to $(-3,-1,2,4)$, the cumulative sums $Y$ in question will be $(0,-3,-4,-2,2)$. In this $Y$, any value less than $1$ appears before any value not less than $1$."],["4 -1\n1 -2 3 -4","No"],["10 1000000000\n-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000 1000000000 1000000000","Yes\n-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"]],"created_at":"2026-03-03 11:01:14"}}