14051405 SUSTech Online Judge
Problem 1405 --Balloon Circles

## 1405: Balloon Circles

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 353  Solved: 100
[Submit][Status][Web Board]

## Description

Volunteers are preparing balloons for the 10th anniversary of SUSTech. The volunteers found that the balloons they buy are all strung into circles (see the figure below). The balloons are connected by ropes, and the volunteer need to use scissor to cut some ropes to separate the circle into parts. For example, for a circle with 4 balloons, at least 2 ropes need to be cut if we want to get 2 separated parts, and each part has 2 balloons. Now, the volunteers find that there are $$n$$ balloon circles in the warehouse, the $$i$$-th circle has $$c_i$$ balloons, and there are $$m$$ different rooms that need decoration. So what is the least number of ropes the need to be cut so that every room can be decorated by at least two rope-connected balloons?  ## Input

The first line contains two integers $$n$$ and $$m$$ ($$1\leq n \leq m \leq 100000$$), indicating the number of balloon circles and the number of rooms.
The second line contains $$n$$ integers, $$c_1, c_2, ..., c_n$$, ($$2\leq c_i \leq 100000$$), where $$c_i$$ indicates the number of balloons in the $$i$$-th circle.

## Output

Print the minimum number of ropes need to be cut so that each room can be decorated by at least two rope-connected balloons. If there is no way to decorate all rooms, print "impossible".

## Sample Input

1 3
6

## Sample Output

3

2 3

2 4

2

2 7

7 7

impossible

[Submit][Status]