영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
There are n people who want to get to the top of a building which has only one elevator. You know the weight of each person and the maximum allowed weight in the elevator. What is the minimum number of elevator rides?
Input
The first input line has two integers n and x: the number of people and the maximum allowed weight in the elevator.
The second line has n integers w_1,w_2,…,w_n: the weight of each person.
Output
Print one integer: the minimum number of rides.
Constraints
- 1 ≤ n ≤ 20
- 1 ≤ x ≤ 10^9
- 1 ≤ w_i ≤ x
예제
예제 1
4 10 4 8 6 1
2