1511Jasmine Eats Noodles

1511   Jasmine Eats Noodles

题目描述

Jasmine likes eating noodles. One day when she eats noodles, she uses chopsticks to pick one section and finds its too long to eat at one time. So she needs to cut it into some shorter sections.

Now you will know each section of noodles in Jasmines bowl, please calculate at least how many times Jasmine will cut the noodles so that she can eat all noodles. Assuming Jasmine can only pick one section to eat at one time, and for each cut she can only divide one section into two section.

 

输入格式:

There are multiple cases.

For each case, the first line contains two integer N and M, indicating there are N sections of noodles in the bowl and Jasmine can eat at most length M of a section at one time.

 

The second line contains N integers Li, indicating the length of each section.

All integers will be in the range of 1 to 100 inclusively.

输出格式:

  For each case, output at least how many times Jasmine will cut the noodles so that she can eat all noodles.

输入样例 复制
5 2
1 2 3 4 5
2 3
3 3
输出样例 复制
4
0

说明

59
100
通过提交
时空限制1000ms/64mb
题目来源
评测方式在线评测
题目类型基础入门
难        度