The Situation:
Several (M
) dwarves have found a goblin's chest with N
gold coins and have to divide them. Due to ancient rules governing the allocation of loot to pirates in order of seniority, the oldest dwarf should get one coin more than the next oldest dwarf, and so on, so that the youngest dwarf gets M-1
fewer coins than the oldest dwarf. Additionally, no dwarf has to pitch in any coins (ie no negative coins to any dwarfs)
Help the dwarves to divide the coins in this way, or tell them that this is impossible.
Winner's code must always answer correctly (this challenge is deterministic) and follow the general code-golf rules.
Input
You are given an integer N (3 ≤ N ≤ 1000) for number of coins and an integer M (3 ≤ M ≤ N) for number of dwarves, space-separated.
Output
If it is impossible to divide the coins in the way that dwarves want, print -1 (minus one). Otherwise, print the numbers of coins that each dwarf will receive, from oldest to youngest. Separate the numbers with spaces.
Samples:
input
3 3
output
2 1 0
input
9 3
output
4 3 2
input
7 3
output
-1
input
6 4
output
3 2 1 0