Cleaning the Club Room!

Pick exactly M evenings to reset dirt to zero so the sum of daily visitors times dirt since the last cleaning is smallest.

Medium5Dynamic programmingPrefix sumInterviewNo attempts yetTime limit1sMemory limit128 MB

Problem

Namgyu manages the club room. More people use it than before, the room has gotten dirty, and everyone who comes in feels discomfort.

The discomfort one person feels equals the dirtiness of the room on the morning of the day that person comes in. If the dirtiness is 3 on a day when 5 people come, all five feel discomfort 3, so the discomfort of that day adds up to 15. The dirtiness then grows by the number of people who came and left that day. In short, if the dirtiness on some morning is dd and pp people come and go that day, the discomfort of that day totals d×pd \times p, and after everyone leaves the dirtiness becomes d+pd + p.

Namgyu is lazy, so he cleans on exactly MM of the NN days. Cleaning always happens in the evening after everyone has left, and the dirtiness becomes 0 on the evening of a cleaning day. The dirtiness on the first morning is 0.

You know in advance how many people come and go on each of the NN days. Find the cleaning plan that makes the total discomfort as small as possible.

Input

The first line contains NN and MM. (1N1001 \le N \le 100, 1Mmin(10,N)1 \le M \le \min(10, N))

The second line contains the number of people who come and go on each day, P1,P2,,PNP_1, P_2, \ldots, P_N, separated by spaces. (1Pi201 \le P_i \le 20)

Output

On the first line, print the minimum possible total discomfort felt over the NN days.

On the second line, print the MM cleaning days that achieve that minimum, in increasing order, separated by single spaces. If several plans achieve the minimum, print the one whose increasing sequence of days is lexicographically smallest.

Hint

Over 8 days the numbers of people are 5,8,6,10,1,15,3,95, 8, 6, 10, 1, 15, 3, 9. Cleaning on the evenings of day 3 and day 6 gives these values.

Day12345678
Dirtiness in the morning05130101103
Discomfort that day04078010165027
Discomfort so far040118118128293293320