#K10126. Find Valid Command Sequence
Find Valid Command Sequence
Find Valid Command Sequence
You are given two integers N and S. Your task is to construct a sequence of N positive integers \(a_1, a_2, \ldots, a_N\) such that:
- The sum of the sequence is \(\sum_{i=1}^{N}a_i = S\).
- The greatest common divisor of all elements is 1, i.e. \(\gcd(a_1,a_2,\ldots,a_N)=1\).
If such a sequence exists, output the sequence (the numbers separated by a single space). If not, output Impossible (case-sensitive).
Note: Each element of the sequence must be at least 1.
inputFormat
The input is given on a single line containing two space-separated integers N and S:
N
: The number of elements in the sequence.S
: The required sum of the sequence.
outputFormat
If a valid sequence exists, output N space-separated integers that form the sequence. Otherwise, output Impossible.
## sample5 10
1 1 1 1 6