Under construction

Still being built. Things may change

Not Fun Problem

Time limit2sMemory limit1024 MB

Summary
Given N and M, build a length-N integer array with values in [0, 10^9] whose contiguous subarray sums cover every value from 0 to M and no value above M.
Level

Medium6 of 10

Topics
Array, Math
Solved
No attempts yet

Problem

This problem is not fun. Most people would skip a problem like this, but you, a contestant, have to solve it.

Given NN and MM, find a sequence AA of length NN that satisfies all of the following conditions. Such a sequence always exists.

  • For every integer xx with 0≤x≤M0 \leq x \leq M, there exist integers ll and rr such that ∑k=lrAk=x\sum_{k=l}^{r} A_k = x. (1≤l≤r≤N1 \leq l \leq r \leq N)
  • For every integer xx with x>Mx > M, there do not exist integers ll and rr such that ∑k=lrAk=x\sum_{k=l}^{r} A_k = x. (1≤l≤r≤N1 \leq l \leq r \leq N)
  • For every integer ii with 1≤i≤N1 \leq i \leq N, 0≤Ai≤1090 \leq A_i \leq 10^9.
  • Every element of sequence AA is an integer.

Input

The first line contains two integers NN and MM, separated by a space. (1≤N≤1 0001 \leq N \leq 1\,000; 0≤M≤⌊N2/4⌋0 \leq M \leq \left\lfloor N^2/4 \right\rfloor)

Output

Print A1,A2,⋯ ,ANA_1, A_2, \cdots, A_N on the first line, separated by spaces.

Examples3

  1. Example 1

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

    Input
    5 5
    
    Expected output
    0 2 0 2 1
    
  3. Example 3

    Input
    4 4
    
    Expected output
    0 2 1 1