Non Arithmetic Progression Set

AtCoder
IDarc145_d
Time2000ms
Memory256MB
Difficulty
Construct a set $S$ of integers satisfying all of the conditions below. It can be proved that at least one such set $S$ exists under the Constraints of this problem. * $S$ has exactly $N$ elements. * The element of $S$ are distinct integers between $-10^7$ and $10^7$ (inclusive). * $\displaystyle \sum _{s \in S} s = M$. * $y-x\neq z-y$ for every triple $x,y,z$ $(x < y < z)$ of distinct elements in $S$. ## Constraints * $1 \leq N \leq 10^4$ * $|M| \leq N\times 10^6$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $N$ $M$ [samples]
Samples
Input #1
3 9
Output #1
1 2 6

We have $2-1 \neq 6-2$ and $1+2+6=9$, so this output satisfies the conditions. Many other solutions exist.
Input #2
5 -15
Output #2
\-15 -5 0 2 3

$M$ may be negative.
API Response (JSON)
{
  "problem": {
    "name": "Non Arithmetic Progression Set",
    "description": {
      "content": "Construct a set $S$ of integers satisfying all of the conditions below. It can be proved that at least one such set $S$ exists under the Constraints of this problem. *   $S$ has exactly $N$ elements.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc145_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Construct a set $S$ of integers satisfying all of the conditions below. It can be proved that at least one such set $S$ exists under the Constraints of this problem.\n\n*   $S$ has exactly $N$ elements....",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments