Robin Hood
면접 대비시간 제한3초메모리 제한256 MB
남은 돈이 100보다 많은 사람 중 가장 부유한 사람에게서 100씩 K번 훔칠 때, 마지막 재산을 출력하고 불가능하면 impossible을 출력한다.
문제
Elders of the village foresee a harsh winter and Robin Hood is worried about the wellbeing of those less well off. As usual, he will be doing a bit of wealth redistribution in the kingdom, that is, he plans to steal from the rich. He estimates that heists will be required. However, Robin Hood has a moral codex that determines who the best target is. He always steals from the richest person – if there are several, he will pick the first one on the list. He only steals monetary units at the time and never steals from anybody who would be left with (or less) money after the heist.
You are provided with the information about the wealth of men and the number of heists, denoted as . Compute the amount of wealth left after performed heists according to the described moral codex.
입력
The first line contains two space-separated integers, and . The second line contains space-separated integers , the wealth of all Robin Hood’s targets.
출력
Print the amount of wealth after the thefts, or print impossible if Robin Hood cannot perform that many thefts.