CF356D Bags and Coins
Description
When you were a child you must have been told a puzzle of bags and coins. Anyway, here's one of its versions:
A horse has three bags. The first bag has one coin, the second bag has one coin and the third bag has three coins. In total, the horse has three coins in the bags. How is that possible?
The answer is quite simple. The third bag contains a coin and two other bags.
This problem is a generalization of the childhood puzzle. You have $ n $ bags. You know that the first bag contains $ a_{1} $ coins, the second bag contains $ a_{2} $ coins, ..., the $ n $ -th bag contains $ a_{n} $ coins. In total, there are $ s $ coins. Find the way to arrange the bags and coins so that they match the described scenario or else state that it is impossible to do.
Input Format
The first line contains two integers $ n $ and $ s $ $ (1
Output Format
If the answer doesn't exist, print -1.
Otherwise, print $ n $ lines, on the $ i $ -th line print the contents of the $ i $ -th bag. The first number in the line, $ c_{i} $ $ (0
Explanation/Hint
The pictures below show two possible ways to solve one test case from the statement. The left picture corresponds to the first test case, the right picture corresponds to the second one.
