This page is still under construction.

Parts of this page are still being built. What you see may change.

One-sequence

Time limit1sMemory limit128 MB

Summary
Find the lexicographically smallest walk of length n starting at 0 with +/-1 steps whose total sum is S, or report that none exists.
Level

Medium6 of 10

Topics
Greedy, Implementation, Math, Prefix sum
Solved
No attempts yet

Problem

We call a sequence of integers a one-sequence when the difference between any two consecutive elements is either 11 or −1-1 and its first element is 00. Formally, [a1,a2,…,an][a_1, a_2, \ldots, a_n] is a one-sequence when:

  • for every kk with 1≤k<n1 \le k < n: ∣ak−ak+1∣=1|a_k - a_{k+1}| = 1, and
  • a1=0a_1 = 0.

You are given the length nn of the sequence and the required sum SS of its elements. Several one-sequences of length nn can share the same sum, so you must output the lexicographically smallest one: compare two sequences element by element and prefer the one whose first differing element is smaller (because a1a_1 is always 00, the order is decided from a2a_2 onward). If no one-sequence of length nn sums to SS, report that no such sequence exists.

Input

The first line contains an integer nn with 1≤n≤100001 \le n \le 10000, the number of elements in the sequence. The second line contains an integer SS with ∣S∣≤50000000|S| \le 50000000, the required sum of the elements.

Output

If a one-sequence of length nn whose elements sum to SS exists, print its elements one per line, giving the lexicographically smallest such sequence (the kk-th element on the kk-th line). Otherwise print NIE (Polish for "no").

Examples4

  1. Example 1

    Input
    8
    4
    
    Expected output
    0
    -1
    0
    -1
    0
    1
    2
    3
    
  2. Example 2

    Input
    1
    0
    
    Expected output
    0
    
  3. Example 3

    Input
    1
    5
    
    Expected output
    NIE
    
  4. Example 4

    Input
    2
    1
    
    Expected output
    0
    1