#GD0000018. Tham lam và DP - Đổi tiền (Greedy vs DP - Coin Change)

Tham lam và DP - Đổi tiền (Greedy vs DP - Coin Change)

Greedy vs DP - Coin Change

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given nn distinct positive coin denominations including 11 and a limit VmaxV_{max}, compare largest-coin-first greedy with the true minimum number of coins for every amount from 11 through VmaxV_{max}. Find the smallest amount where greedy fails, or print -1 if none exists in the range.

Input

The first line contains n,Vmaxn,V_{max}. The second line contains nn distinct denominations.

Output

If a counterexample exists, print the smallest VV, the greedy count, and the optimal count. Otherwise print -1.

Subtasks

General constraints:

  • 1≤n≤201 \le n \le 20.

  • 1≤Vmax≤2⋅1041 \le V_{max} \le 2\cdot10^4.

  • 1≤ci≤Vmax1 \le c_i \le V_{max}.

  • The cic_i are distinct and one denomination equals 11.

  • Subtask 1 (20 points): n≤6n \le 6, Vmax≤100V_{max} \le 100

  • Subtask 2 (30 points): n≤12n \le 12, Vmax≤2000V_{max} \le 2000

  • Subtask 3 (50 points): No additional constraints.

Examples

Input

3 20
1 3 4

Output

6 3 2

Explanation

For amounts 11 through 55, greedy is still optimal. At V=6V=6, greedy uses 4+1+14+1+1 (three coins) while the optimum is 3+33+3 (two coins), so 66 is the smallest counterexample.