In Homeric Epics there are n different words numbered from 1 to n. The i-th word appears w_i times in the text. Allison wants to substitute the i-th word with a k-ary string s_i, satisfying the following constraint: for any 1≤i,j≤n, i=j, s_i is not the prefix of s_j.
Allison wants to know how to choose s_i so that the resulting text has minimum length. Under the assumption that the total length of the text is minimal, Allison wants to know what is the shortest possible length of the longest s_i.
A string is called a k-ary string if and only if its characters are in 0,1,…,k−1.
A string s_1 is said to be a prefix of s_2 if and only if there exists 1≤t≤m such that s_1=s_2\[1…t] where m is the length of s_2 and s_2\[1…t] represents the substring of s_2 formed by the first t characters.
The first line of the input file contains two integers n,k separated by one space, denoting there are n words in total and we need to substitute the words with a k-ary string.
In the following n lines, the (i+1)-th line has a nonnegative integer w_i denoting the number of times the i-th word has occurred.
The output consists of two lines. The first line is an integer denoting the minimum length of the Homeric Epics after substitution. The second line is an integer denoting the minimum length of the longest string s_i given the total length is minimum.