This question already has an answer here:
There is a job which can be decomposed into
x equally-sized smaller tasks. You have a team of size
y <= x, where every member works equally fast on any task. The goal for this challenge is to divide the work as evenly as possible such that every member of your team has at least 1 task to perform. As evenly as possible means that given any member
a, the number of tasks it must perform may be at most one more than any other member
b. A single task cannot be further divided or worked on simultaneously by two members.
Your program/function will take as input two positive integers
y is guaranteed to be less than or equal to
x. You are free to decide in what order your program will take these inputs. You may take the inputs from any input source desired.
Your program/function will output a list of positive integers of length
y representing the number of tasks each member must perform. The list may be in any order. For example, the following outputs are identical:
2 1 2 1 1 1 2 2 2 2 1 1
Outputs may be to any output sink desired.
Each line pair denotes inputs and one possible output. These example inputs specify
1 1 1 4 1 4 4 2 2 2 4 3 2 1 1 4 4 1 1 1 1 10 3 3 4 3 10 7 1 2 2 2 1 1 1
This is code golf; shortest code wins. Standard loopholes apply.