CSES - Elevator Rides | Đi thang máy

View as PDF



Authors:
Problem types
Points: 1900 (p) Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

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,\ldots,w_n\): the weight of each person.

Output

  • Print one integer: the minimum number of rides.

Constraints

  • \(1 \leq n \leq 20\)
  • \(1 \leq x \leq 10^9\)
  • \(1 \leq w_i \leq x\)

Example

Sample input

4 10  
4 8 6 1  

Output:

2


Comments (12)

Most recent
Loading comments...