#K77182. Divide Range into Contiguous Segments

    ID: 34808 Type: Default 1000ms 256MiB

Divide Range into Contiguous Segments

Divide Range into Contiguous Segments

You are given two integers n and k. Your task is to divide the range [1, n] into k contiguous segments, ensuring that each segment contains at least one element. The goal is to minimize the difference between the sums of these segments. It can be shown that if we express n as

\( n = k \times q + r \)

where q is the integer quotient and r is the remainder, then the optimal strategy is to assign q+1 elements to the first r segments and q elements to the remaining segments. The output should list the number of elements in each segment in order.

inputFormat

The input consists of two integers n and k separated by whitespace. They are provided in a single line from standard input.

outputFormat

Output k integers representing the number of elements in each contiguous segment. The numbers should be printed in order separated by a single space to standard output.

## sample
10 3
4 3 3