题目描述
Problem Description
Pink Rabbit is studying at University T. On January 54th, University T began its semester-end examination period.
Pink Rabbit has $n$ subjects to be examined this semester, numbered sequentially as $1, 2, \cdots, n$ according to their examination dates. Each subject has a difficulty coefficient $a_i$.
Preparing for all these exams could lead to a surge in stress for Pink Rabbit. Therefore, he plans to prepare for and take only a portion of the exams, applying for deferred examinations for the rest. Specifically, he can choose to prepare for any number of the first exams (which could be zero or all $n$ exams), leaving the remaining subjects unprepped.
However, deferred exams still need to be taken next semester, so Pink Rabbit will evaluate his decision using a "stress value."
Specifically, let's say Pink Rabbit chooses to take the first $k$ exams ($0 \leq k \leq n$). Given a stress coefficient $c$, his stress value $t$ is calculated as follows:
$$ t = \max \limits_{i = 1}^{k} a_i + c \times (n - k) $$
where $\max \limits_{i = 1}^{k} a_i$ represents the maximum value among $a_1, a_2, \cdots, a_k$. If $k = 0$, then $\max \limits_{i = 1}^{k} a_i = 0$.
Now, Pink Rabbit knows the number of subjects $n$ and the difficulty coefficients $a_1, a_2, \cdots, a_n$ for each subject. Please help him calculate the number of subjects he needs to prepare for to minimize his "stress value."
Input Format
The input consists of two lines.
The first line contains two integers $n, c$, representing the number of subjects and the stress coefficient, respectively.
The second line contains $n$ integers $a_1, a_2, \cdots, a_n$, representing the difficulty coefficients of each subject.
Output Format
The output consists of one line with two integers, representing the number of subjects $k$ Pink Rabbit needs to prepare for to minimize his "stress value" and the corresponding minimum "stress value". If multiple $k$ values result in the same minimum "stress value", output the smallest $k$.
Sample Input and Output
Sample Input #1
3 2
2 3 5
Sample Output #1
2 5
Sample Input #2
10 3
6 4 5 5 6 2 2 4 19 9
Sample Output #2
8 12
Sample Input #3
3 2
7 2 5
Sample Output #3
0 6
Notes
Data Range and Constraints
For $100\%$ of the data, it is guaranteed that $0 \leq n \leq 10^6$, $1 \leq a_i \leq 10^9$, $1 \leq c \leq 10^9$.
| Test Case Number | $n$ | $a_i$ |
|---|---|---|
| 1 | $= 0$ | $\leq 10^9$ |
| 2 | $= 1$ | $\leq 10^9$ |
| 3 to 5 | $\leq 10$ | $\leq 10^9$ |
| 6 | $\leq 10^6$ | $= 1$ |
| 7 to 10 | $\leq 10^6$ | $\leq 10^9$ |
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分