eolymp
bolt
Try our new interface for solving problems
Problems

The Young Networker

The Young Networker

The early 2000's... Having just boasted about your extensive experience in designing small-scale home networks, you were asked to take on the job for your apartment block. Now is probably not the time to confess that this is really your first attempt. So, the network will connect \textbf{N} users. Each of them connects to one of the hubs via a dedicated network cable. The hubs may also be connected to one another with similar cables. Any socket of a hub may be used by either an end user or for a connection to another hub. The final network will have to enable any pair of users to communicate with each other via one or more hubs. Digging through your piles of old hardware, you found \textbf{M} hubs suitable for the purpose. The \textbf{i}-th of those hubs (\textbf{1} ≤ \textbf{i} ≤ \textbf{M}) has \textbf{k_i} sockets for network cables. As you have promised that each end user will only have pay for the cable to connect themselves to the nearest hub, you want to design the network using minimal number of your hubs (so you can keep the rest for future projects). Are you up to the task? \InputFile The first input line contains the integers \textbf{N} and \textbf{M} (\textbf{2} ≤ \textbf{N} ≤ \textbf{1000}, \textbf{1} ≤ \textbf{M} ≤ \textbf{300}). The second line contains \textbf{M} integers, the values of \textbf{k_i} (\textbf{2} ≤ \textbf{k_i} ≤ \textbf{48}). \OutputFile If there is no solution, the only line of output should contain the text \textbf{Epic fail}. Otherwise, the first line of output should contain \textbf{K}, the number of hubs used, and the second line \textbf{K} integers, the numbers of the hubs (they are numbered starting from one in the order they are given in the input). If there are several solutions, output any one of them.
Time limit 1 second
Memory limit 256 MiB
Input example #1
10 2
48 10
Output example #1
1
1
Source NEERC Western Subregional Contest 2012