SQL: generate N random positive integers adding up to a provided total M : This problem keeps popping up in different programming languages:

- [R](http://stackoverflow.com/questions/24845909/generate-n-random-integers-that-sum-to-m-in-r)
- [Java](http://stackoverflow.com/questions/10021796/how-to-generate-a-sequence-of-n-random-positive-integers-which-add-up-to-some-va)
- [Python](http://stackoverflow.com/questions/40231094/generate-n-positive-integers-within-a-range-adding-up-to-a-total-in-python)

This question is about a "vanilla" SQL solution restricted to a single SELECT statement with optional common table expressions [CTEs]. The input is a 1x2 table call `inputs`: a single row with columns `M` and `N` of `int` type. The result should be an Nx1 table with a single column `i` for the integers that add us to `M`.