The Baric Bovine

No attempts yetTime limit1sMemory limit128 MB

Problem

During one day Bessie takes $N$ atmospheric-pressure measurements and numbers them $M_1, M_2, \dots, M_N$ in the order she observes them ($1 \le N \le 100$, $1 \le M_i \le 1{,}000{,}000$).

Bessie wants a subset of the measurements — indices $s_1 < s_2 < \dots < s_K$ ($1 \le K \le N$) — that represents the whole set well, i.e. keeps the error defined below small.

Every index $i$ that is not in the subset contributes an error:

  • if $i < s_1$: $2 \cdot |M_i - M_{s_1}|$
  • if $s_j < i < s_{j+1}$ for some $j$: $|2 M_i - (M_{s_j} + M_{s_{j+1}})|$
  • if $i > s_K$: $2 \cdot |M_i - M_{s_K}|$

The total error is the sum of these individual errors. Given a maximum error $E$ ($1 \le E \le 1{,}000{,}000$), find the size of the smallest subset whose total error is at most $E$.

Input

  • Line 1: two space-separated integers $N$ and $E$.
  • Lines 2 to $N+1$: line $i+1$ contains the single integer $M_i$.

Output

  • Line 1: two space-separated integers — the size of the smallest subset whose total error is at most $E$, and the least possible total error achievable with a subset of that size.

Hint

For example, with measurements $10, 3, 20, 40$, choosing the 2nd and 4th measurements is optimal and gives a total error of $17$. The measurement before the first chosen index contributes $2 \cdot |10 - 3| = 14$, and the measurement between the two chosen indices contributes $|2 \cdot 20 - (3 + 40)| = 3$.