#include <bits/stdc++.h>
using namespace std;
#define ll long long
//for math u can observe something related to gcd or something related to even or odd to draw some conclusions
//if your answer is lieing in a range then binary search is the best approach to solve that problem
//for errors check out of bound and overflow of integers
//sorting,binary search,dynamic programming,greedy are some of the most used techniques to solve the problems
//until some element it is good and then next it is bad u should use binary search
//to find the first good element or to find the first bad element we use binary search\
//if there are digits then remember that the digits are just from 0-9 so u can use two loops the same for character a-z they are just 26
int main() {
// your code goes here
int t;
t=1;
while(t--)
{
int n;
ll k;
cin>>n>>k;
ll a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int cnt=0;
ll maxi=k;
sort(a,a+n);
int p=0;
for(int i=0;i<n;i++)
{
if(i!=0)
{
maxi=max(maxi,a[i-1]);
if(a[i]>2*maxi)
{
while(a[i]>2*maxi )
{
maxi*=2;
cnt++;
}
}
}
else
{
if(a[i]>2*k)
{
maxi=k;
while(a[i]>2*maxi)
{
maxi*=2;
cnt++;
}
}
}
}
cout<<cnt<<endl;
}
return 0;
}
938A - Word Correction | 159C - String Manipulation 10 |
258A - Little Elephant and Bits | 1536C - Diluc and Kaeya |
1428C - ABBB | 1557A - Ezzat and Two Subsequences |
255A - Greg's Workout | 1059A - Cashier |
1389C - Good String | 1561A - Simply Strange Sort |
1337B - Kana and Dragon Quest game | 137C - History |
1443C - The Delivery Dilemma | 6C - Alice Bob and Chocolate |
1077C - Good Array | 285B - Find Marble |
6A - Triangle | 1729A - Two Elevators |
1729B - Decode String | 1729C - Jumping on Tiles |
1729E - Guess the Cycle Size | 553B - Kyoya and Permutation |
1729D - Friends and the Restaurant | 1606C - Banknotes |
580C - Kefa and Park | 342A - Xenia and Divisors |
1033A - King Escape | 39D - Cubical Planet |
1453A - Cancel the Trains | 645A - Amity Assessment |