Construct an table of positive integers whose diagonal sum is exactly , with all other cells set to $1$.
You are given two integers and . Build an table of positive integers such that:
If multiple tables are possible, any valid one is acceptable.
This is a straightforward construction problem: the only values you are free to choose are the diagonal cells, while all non-diagonal cells are fixed to $1$.
If exact original contest limits are unknown, treat the task as requiring a valid constructive output for arbitrary feasible and .
Example 1
Input
3 7
Output
2 1 1 1 2 1 1 1 3
Explanation
The diagonal sum is , and every non-diagonal cell is $1$.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.