PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000191. Gán bằng hoặc giảm đi (Set or Decrease)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Gán bằng hoặc giảm đi (Set or Decrease)

Set or Decrease

Source: Codeforces

Version: Phuoc Hung OJ (single-case adaptation where applicable)

Problem Statement

Given nn positive integers aia_i and an integer kk, one operation either (1) decreases a chosen element by exactly 11 (negative values allowed), or (2) chooses indices i,ji,j and assigns ai←aja_i\gets a_j. Find the minimum operations to make the array sum at most kk.

Input

The first line contains n,kn,k. The second contains nn positive integers aia_i.

Output

Print the minimum number of operations.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le 12; 1≤k≤10151\le k\le 10^{15}; 1≤ai≤2001\le a_i\le 200 for every 1≤i≤n1\le i\le n.
  • Subtask 2 (30 points): 1≤n≤30001\le n\le 3000; 1≤k≤10151\le k\le 10^{15}; 1≤ai≤10000001\le a_i\le 1000000 for every 1≤i≤n1\le i\le n.
  • Subtask 3 (50 points): 1≤n≤2000001\le n\le 200000; 1≤k≤10151\le k\le 10^{15}; 1≤ai≤10000000001\le a_i\le 1000000000 for every 1≤i≤n1\le i\le n.

Examples

Example 1

Input

1 10
20

Output

10

Explanation

There is only one element; it must be decreased from 20 to 10 in 10 steps.

Example 2

Input

7 8
1 2 1 3 1 2 1

Output

2

Explanation

Assign the element equal to 3 to the value 1, then decrease one occurrence of 1 to 0. Two operations reduce the sum to at most 8.