You split M kids into N teams. First you put K kids into the first team, then K kids into the second team, and so on up to the Nth team. After the Nth team you turn around and keep putting K kids into each team, going from the (N−1)th team down to the first team. After the first team you turn around again, continue from the second team up to the Nth team, and repeat until no kids are left to hand out.
For example, with three teams the kids go into the teams in this order: 1, 2, 3, 2, 1, 2, 3, and so on.
If fewer than K kids are left when a team comes up, that team takes every remaining kid and the process ends.
Report how many kids each team holds once the process ends.