Makes solves problems on Decoforces and lots of other different online judges. Each problem is denoted by its difficulty — a positive integer number. Difficulties are measured the same across all the judges (the problem with difficulty d on Decoforces is as hard as the problem with difficulty d on any other judge). 

Makes has chosen n problems to solve on Decoforces with difficulties a_1, a_2, ..., a_{n}. He can solve these problems in arbitrary order. Though he can solve problem i with difficulty a_{i} only if he had already solved some problem with difficulty $d \geq \frac{a_{i}}{2}$ (no matter on what online judge was it).

Before starting this chosen list of problems, Makes has already solved problems with maximum difficulty k.

With given conditions it's easy to see that Makes sometimes can't solve all the chosen problems, no matter what order he chooses. So he wants to solve some problems on other judges to finish solving problems from his list. 

For every positive integer y there exist some problem with difficulty y on at least one judge besides Decoforces.

Makes can solve problems on any judge at any time, it isn't necessary to do problems from the chosen list one right after another.

Makes doesn't have too much free time, so he asked you to calculate the minimum number of problems he should solve on other judges in order to solve all the chosen problems from Decoforces.


-----Input-----

The first line contains two integer numbers n, k (1 ≤ n ≤ 10^3, 1 ≤ k ≤ 10^9).

The second line contains n space-separated integer numbers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^9).


-----Output-----

Print minimum number of problems Makes should solve on other judges in order to solve all chosen problems on Decoforces.


-----Examples-----
Input
3 3
2 1 9

Output
1

Input
4 20
10 3 6 3

Output
0



-----Note-----

In the first example Makes at first solves problems 1 and 2. Then in order to solve the problem with difficulty 9, he should solve problem with difficulty no less than 5. The only available are difficulties 5 and 6 on some other judge. Solving any of these will give Makes opportunity to solve problem 3.

In the second example he can solve every problem right from the start.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Implementation

Greedy algorithms


Solutions:
(n, k) = list(map(int, input().split()))
a = sorted(map(int, input().split()), reverse=True)
while len(a) > 0 and a[-1] <= k:
	a.pop()
a.append(k)
ans = 0
while len(a) > 1:
	(u, v) = (a[-1], a[-2])
	while u * 2 < v:
		ans += 1
		u *= 2
	a.pop()
print(ans)


(n, k) = map(int, input().split())
A = sorted([int(x) for x in input().split()])
result = 0
for x in A:
	while x > 2 * k:
		k *= 2
		result += 1
	k = max([k, x])
print(result)


(n, k) = map(int, input().split())
ans = 0
for i in sorted(map(int, input().split())):
	while i > 2 * k:
		ans += 1
		k *= 2
	k = max(k, i)
print(ans)


inp = input().split(' ')
k = int(inp[1])
maxSolved = k
problems = sorted([int(i) for i in input().split(' ')])
other = 0
for i in problems:
	while i > maxSolved * 2:
		other += 1
		maxSolved *= 2
	if i > maxSolved and i <= maxSolved * 2:
		maxSolved = i
print(other)


from math import *
R = lambda : map(int, input().split())
(n, k) = R()
l = list(R())
l.sort()
ans = 0
for i in range(n):
	if l[i] > 2 * k:
		x = log((l[i] - 1) / k) / log(2)
		x = int(x)
		ans += x
		k = l[i]
	elif l[i] > k:
		k = l[i]
print(ans)


def judge():
	count = 0
	S = input()
	T = input()
	sList = S.split()
	sList = [int(i) for i in sList]
	tList = T.split()
	n = sList[0]
	k = sList[1]
	tList = [int(i) for i in tList]
	uList = sorted(tList)
	for num in uList:
		if 2 * k >= num:
			if k < num:
				k = num
			pass
		else:
			while True:
				k = 2 * k
				count += 1
				if 2 * k >= num:
					if k < num:
						k = num
					break
	print(count)
judge()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if a[-1] <= k * 2:
	print(0)
	exit(0)
ans = 0
d = k * 2
for ai in a:
	while ai > d:
		d *= 2
		ans += 1
	if ai * 2 > d:
		d = ai * 2
print(ans)


(n, k) = [int(i) for i in input().split()]
a = sorted((int(i) for i in input().split()))
ans = 0
for i in range(n):
	while a[i] / 2 > k:
		k *= 2
		ans += 1
	k = max(k, a[i])
print(ans)


(n, k) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
a.sort()
curr = k
b = []
i = 0
while i < n:
	if a[i] <= 2 * curr:
		b.append(a[i])
		curr = max(curr, a[i])
		i += 1
	else:
		while a[i] > 2 * curr:
			curr *= 2
			b.append(curr)
print(len(b) - len(a))


s = input().split(' ')
n = int(s[0])
k = int(s[1])
s = input().split(' ')
arr = []
for a in s:
	arr.append(int(a))
arr.sort()
tot = 0
for i in range(0, n):
	while 2 * k < arr[i]:
		k *= 2
		tot += 1
	k = max(k, arr[i])
print(tot)


from sys import stdin, stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
from random import *
from itertools import permutations
input = stdin.readline
prin = stdout.write
from random import sample
from collections import Counter, deque
from fractions import *
from math import sqrt, ceil, log2, gcd, cos, pi, floor
from copy import deepcopy
mod = 10 ** 9 + 7
mod2 = 998244353

def ps(n):
	cp = 0
	lk = 0
	arr = {}
	lk = 0
	ap = n
	cc = 0
	while n % 2 == 0:
		n = n // 2
		cc = 1
	if cc == 1:
		lk += 1
	for ps in range(3, ceil(sqrt(n)) + 1, 2):
		cc = 0
		while n % ps == 0:
			n = n // ps
			cc = 1
		lk += 1 if cc == 1 else 0
	if n != 1:
		lk += 1
	if lk == 1:
		return False
	return True

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def factorials(n, r):
	slr = n
	dpr = r
	qlr = 1
	qs = 1
	mod = 10 ** 9 + 7
	for ip in range(n - r + 1, n):
		qlr = qlr * ip % mod
	for ij in range(1, r):
		qs = qs * ij % mod
	ans = qlr * modInverse(qs) % mod
	return ans

def modInverse(b):
	qr = 10 ** 9 + 7
	return pow(b, qr - 2, qr)
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def power(arr):
	listrep = arr
	subsets = []
	for i in range(2 ** len(listrep)):
		subset = []
		for k in range(len(listrep)):
			if i & 1 << k:
				subset.append(listrep[k])
		subsets.append(subset)
	return subsets

def pda(n):
	list = []
	su = 0
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				list.append(i)
				su += i
			else:
				list.append(n // i)
				list.append(i)
				su += i
				su += n // i
	return su

def dis(xa, ya, xb, yb):
	return sqrt((xa - xb) ** 2 + (ya - yb) ** 2)

def ii():
	return int(input())

def ilist():
	return [int(x) for x in input().strip().split()]

def islist():
	return list(map(str, input().split().rstrip()))

def inp():
	return input().strip()

def google(test):
	return 'Case #' + str(test) + ': '

def overlap(x1, y1, x2, y2):
	if x2 > y1:
		return y1 - x2
	if y1 > y2:
		return y2 - x2
	return y1 - x2

def dist(x1, y1, x2, y2):
	return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for i in range(1, n + 1):
		if prime[i]:
			ans.append(i)
	return ans

def prod(arr):
	n = len(arr)
	k = 1
	for j in range(n):
		k *= arr[j]
	return k

def SumOfDigits(s):
	su = 0
	while s:
		su += s % 10
		s = s // 10
	return su
t = 1
for pl in range(t):
	(n, k) = ilist()
	arr = ilist()
	li = deepcopy(arr)
	li = sorted(li)[::-1]
	maxi = k
	count = 0
	while len(li) > 0:
		ass = li.pop()
		while maxi < ass / 2:
			maxi = 2 * maxi
			count += 1
		maxi = max(maxi, ass)
	print(count)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
curr = 0
ans = 0
while curr < len(a):
	if k >= a[curr] / 2:
		k = max(k, a[curr])
		curr += 1
	else:
		ans += 1
		k *= 2
print(ans)


(n, k) = map(int, input().split())
t = sorted(list(map(int, input().split())))
c = 0
for i in range(n):
	if k * 2 < t[i]:
		while k * 2 < t[i]:
			c += 1
			k *= 2
	k = max(k, t[i])
print(c)


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
import random

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def primeFactorsCount(n):
	cnt = 0
	while n % 2 == 0:
		cnt += 1
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			cnt += 1
			n = n // i
	if n > 2:
		cnt += 1
	return cnt

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	i = 2
	while i * i <= n:
		if primes[i] == True:
			for j in range(i * i, n + 1, i):
				primes[j] = False
		i += 1
	pr = []
	for i in range(0, n + 1):
		if primes[i]:
			pr.append(i)
	return pr

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
(n, k) = map(int, input().split())
l = sorted(list(map(int, input().split())))
md = k * 2
ans = 0
for i in range(0, n):
	if l[i] <= md:
		md = max(2 * l[i], md)
	else:
		while l[i] > md:
			md *= 2
			ans += 1
		md = max(md, 2 * l[i])
print(ans)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
cnt = 0
for a in A:
	while a > 2 * k:
		cnt += 1
		k *= 2
	k = max(k, a)
print(cnt)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
num = 0
for i in range(n):
	if 2 * k >= a[i]:
		if k < a[i]:
			k = a[i]
	else:
		while 2 * k < a[i]:
			k = 2 * k
			num += 1
		if k < a[i]:
			k = a[i]
print(num)


from math import ceil, log
(n, k) = map(int, input().split())
a = sorted([int(x) for x in input().split()])
ans = 0
for i in a:
	while 2 * k < i:
		k *= 2
		ans += 1
	k = max(i, k)
print(ans)


(n, k) = map(int, input().split())
s = [int(i) for i in input().split()]
s.sort()
ans = 0
for i in s:
	while k < i / 2:
		ans += 1
		k = 2 * k
	k = max(k, i)
print(ans)


import math

def main():
	(n, k) = list(map(int, input().split()))
	P = list(map(int, input().split()))
	P.sort()
	M = k
	count = 0
	for num in P:
		f = math.ceil(math.log2(num / M)) - 1
		if f < 1:
			pass
		else:
			count += f
		M = max(M, num)
	print(count)

def __starting_point():
	main()
__starting_point()


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list(sorted(a))
d = k
ans = 0
for ai in a:
	while 2 * d < ai:
		d *= 2
		ans += 1
	d = max(d, ai)
print(ans)


(n, k) = map(int, input().split())
tasks = sorted(filter(lambda x: x > k, set(map(int, input().split()))))
res = 0
for task in tasks:
	while k << 1 < task:
		k <<= 1
		res += 1
	k = task
print(res)


import sys
(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
for x in a:
	while k * 2 < x:
		k *= 2
		ans += 1
	k = max(k, x)
print(ans)


get = lambda : list(map(int, input().split()))
(n, k) = get()
list = get()
list = sorted(list)
count = 0
for i in list:
	while k < i / 2:
		k = k * 2
		count += 1
	k = max(k, i)
print(count)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
c = 0
for i in range(n):
	while k * 2 < a[i]:
		k = k * 2
		c += 1
	k = max(k, a[i])
print(c)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
kol = 0
while a != []:
	while a != [] and k * 2 >= a[0]:
		k = max(k, a[0])
		a.pop(0)
	k *= 2
	kol += 1
print(kol - 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
while a:
	for i in a:
		if i <= 2 * k:
			i = 0
			while i < n:
				if a[i] <= k * 2:
					k = max(k, a[i])
					del a[i]
					n -= 1
				else:
					i += 1
			break
	else:
		k *= 2
		ans += 1
print(ans)


def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	b = k
	p = 0
	ans = 0
	while p < n:
		while 2 * b < a[p]:
			b = 2 * b
			ans += 1
		b = max(b, a[p])
		p += 1
	print(ans)
main()


def solve():
	(n, k) = get([int])
	k = 2 * k
	A = sorted(get([int]))
	c = 0
	for a in A:
		while a > k:
			c += 1
			k *= 2
		k = max(k, 2 * a)
	return c
_testcases = '\n3 3\n2 1 9\n\n1\n\n4 20\n10 3 6 3\n\n0\n\n'.strip()
import re
import sys
import math
import heapq
from heapq import heapify, heappop, heappush
import bisect
from bisect import bisect_left, bisect_right
import operator
from operator import itemgetter, attrgetter
import itertools
import collections
inf = float('inf')
sys.setrecursionlimit(10000)

def tree():
	return collections.defaultdict(tree)

def cache(func):
	cache_dict = {}

	def _cached_func(*args, _get_cache=False):
		if _get_cache:
			return cache_dict
		if args in cache_dict:
			return cache_dict[args]
		cache_dict[args] = func(*args)
		return cache_dict[args]
	return _cached_func

def equal(x, y, epsilon=1e-06):
	if -epsilon <= x - y <= epsilon:
		return True
	if -epsilon <= x <= epsilon or -epsilon <= y <= epsilon:
		return False
	return -epsilon <= (x - y) / x <= epsilon or -epsilon <= (x - y) / y <= epsilon

def get(_type):
	if type(_type) == list:
		if len(_type) == 1:
			_type = _type[0]
			return list(map(_type, input().strip().split()))
		else:
			return [_type[i](inp) for (i, inp) in enumerate(input().strip().split())]
	else:
		return _type(input().strip())
print(solve())


(n, k) = map(int, input().split())
a = [int(c) for c in input().split()]
a.sort()
i = 0
res = 0
while i < n:
	if k >= a[i] / 2:
		k = max(a[i], k)
		i += 1
	else:
		k *= 2
		res += 1
print(res)


import math
(n, k) = [int(x) for x in input().split()]
pr = [int(x) for x in input().split()]
pr.sort()
count = 0
for i in pr:
	if i > k:
		if math.ceil(i / 2) <= k:
			k = i
		else:
			ct = i
			while True:
				ct = math.ceil(ct / 2)
				count += 1
				if math.ceil(ct / 2) <= k:
					break
			k = i
print(count)


(n, k) = [int(a) for a in input().split()]
ar = [int(a) for a in input().split()]
ar.sort()
ct = 0
i = 0
while i < n:
	if ar[i] > k:
		if ar[i] > 2 * k:
			k *= 2
			ct += 1
		else:
			k = ar[i]
			i += 1
	else:
		i += 1
print(ct)


from sys import stdin, stdout
EPS = 10 ** (-20)
INF = float('inf')
size = 10 ** 6
(n, k) = map(int, stdin.readline().split())
values = sorted(list(map(int, stdin.readline().split())))
i = 0
ans = 0
while i < n:
	if 2 * k >= values[i]:
		k = max(k, values[i])
		i += 1
	else:
		k *= 2
		ans += 1
stdout.write(str(ans))


n_k = [int(x) for x in input().split()]
high = n_k[1] * 2
problems = [int(x) for x in input().split()]
problems.sort()
count = 0
if problems[-1] <= high:
	print(0)
else:
	for i in range(n_k[0]):
		if problems[i] > high:
			while problems[i] > high:
				count += 1
				high *= 2
			temp_high = problems[i] * 2
			if temp_high > high:
				high = temp_high
		else:
			temp_high = problems[i] * 2
			if temp_high > high:
				high = temp_high
		if problems[-1] <= high:
			break
	print(count)


R = lambda : list(map(int, input().split()))
(n, k) = R()
a = sorted(R())
b = 0
for i in a:
	while i > k + k:
		k += k
		b += 1
	k = max(k, i)
print(b)


(n, k) = list(map(int, input().split()))
s = sorted(tuple(map(int, input().split())))
max = k
ans = 0
for a in s:
	if a > max:
		while max < a / 2:
			max = max * 2
			ans = ans + 1
		max = a
print(ans)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
prob = [int(i) for i in input().split()]
solvable = k * 2
prob.sort()
ans = 0
for p in prob:
	while solvable < p:
		ans += 1
		solvable *= 2
	solvable = max(solvable, p * 2)
print(ans)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
ans = 0
for i in sorted(map(int, input().split())):
	while i > 2 * k:
		ans += 1
		k *= 2
	k = max(k, i)
print(ans)


(n, cur) = map(int, input().split())
l = sorted(map(int, input().split()))
res = 0
for e in l:
	while 2 * cur < e:
		cur *= 2
		res += 1
	cur = max(cur, e)
print(res)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
result = 0
for d in a:
	while d > 2 * k:
		k *= 2
		result += 1
	k = max(d, k)
print(result)


import collections
d = collections.deque()
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
x = 0
for i in a:
	d.append(i)
while len(d) > 0:
	while len(d) > 0 and d[0] <= 2 * k:
		k = max(k, d.popleft())
	k = 2 * k
	x += 1
print(x - 1)


import sys
a = sys.stdin.readline().strip('\n')
(n, m) = map(int, a.split(' '))
list1 = list(map(int, input().split(' ')))
sum = 0
list1.sort()
for i in list1:
	while 2 * m < i:
		m *= 2
		sum += 1
	if i > m:
		m = i
print(sum)


(n, k) = map(int, input().split(' '))
arr = sorted([int(i) for i in input().split(' ')])
answer = 0
for i in range(n):
	while 2 * k < arr[i]:
		answer += 1
		k *= 2
	k = max(k, arr[i])
print(answer)


(_, k) = [int(in_part) for in_part in input().strip(' ').split(' ')]
arr = [int(in_part) for in_part in input().strip(' ').split(' ')]
arr.sort()
count = 0
for x in arr:
	while x > 2 * k:
		k *= 2
		count += 1
	if x > k:
		k = x
print(count)


(n, k) = map(int, input().split())
aa = sorted(map(int, input().split()))
answ = 0
for a in aa:
	while 2 * k < a:
		k *= 2
		answ += 1
	k = max(k, a)
print(answ)


import math
I = lambda : list(map(int, input().split()))
(n, k) = I()
a = list(I())
ans = 0
for task in sorted(a):
	if math.ceil(task / 2) <= k:
		k = max(task, k)
		continue
	else:
		while not math.ceil(task / 2) <= k:
			ans += 1
			k *= 2
		k = task
print(ans)


(n, k) = map(int, input().split())
lis = sorted(map(int, input().split()))
c = 0
for i in range(n):
	if lis[i] <= k * 2:
		k = max(lis[i], k)
	else:
		while k * 2 < lis[i]:
			c += 1
			k = k * 2
		k = max(k, lis[i])
print(c)


from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def digits(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def ceil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def mapin():
	return map(int, input().split())
(n, k) = mapin()
a = [int(c) for c in input().split()]
a.sort()
i = 0
ans = 0
while i < n:
	if k >= ceil(a[i], 2):
		k = max(k, a[i])
		i += 1
	else:
		k = 2 * k
		ans += 1
print(ans)


(n, k) = map(int, input().split())
l = sorted([int(x) for x in input().split()])
ans = 0
for i in range(len(l)):
	while 2 * k < l[i]:
		ans += 1
		k *= 2
	k = max(k, l[i])
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
M = k
ans = 0
for ai in a:
	while (ai + 1) // 2 > M:
		M *= 2
		ans += 1
	M = max(M, ai)
print(ans)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = k
a = sorted(a)
cnt = 0
for i in range(n):
	while True:
		if a[i] / 2 <= d:
			d = max(d, a[i])
			break
		else:
			cnt += 1
			d = 2 * d
print(cnt)


import math

def calc(a, b):
	x = 0
	while a < b:
		a = a * 2
		x += 1
	return x
(n, k) = input().split()
(n, k) = (int(n), int(k))
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(0, n):
	if a[i] <= 2 * k:
		k = max(k, a[i])
	elif a[i] > 2 * k:
		ans += calc(k, math.ceil(a[i] / 2))
		k = a[i]
print(ans)


def solve():
	(n, k) = [int(x) for x in input().split(' ')]
	a = [int(x) for x in input().split(' ')]
	a = [k] + [x for x in a if x > k]
	a.sort()
	m = len(a)
	k = 0
	for i in range(1, m):
		while a[i - 1] * 2 < a[i]:
			k += 1
			a[i - 1] *= 2
	return k
print(solve())


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
(n, k) = mints()
a = list(mints())
a.sort()
r = 0
for i in range(n):
	if a[i] > k:
		while k * 2 < a[i]:
			r += 1
			k *= 2
		k = a[i]
print(r)


(n, k) = map(int, input().split())
x = 0
for d in sorted(map(int, input().split())):
	while 2 * k < d:
		k *= 2
		x += 1
	k = max(k, d)
print(x)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
ans = 0
for x in a:
	if x > k * 2:
		while x > k * 2:
			k *= 2
			ans += 1
	k = max(k, x)
print(ans)


read = lambda : map(int, input().split())
(n, k) = read()
a = sorted(read())
cur = k
ans = 0
for i in a:
	while cur * 2 < i:
		cur *= 2
		ans += 1
	cur = max(cur, i)
print(ans)


(n, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
a.sort()
ct = 0
for p in a:
	while k * 2 < p:
		k *= 2
		ct += 1
	k = max(k, p)
print(ct)


(n, k) = map(int, input().split())
dif = list(map(int, input().split()))
dif.sort()
i = 0
ans = 0
while i < n:
	while i < n and dif[i] <= 2 * k:
		k = max(k, dif[i])
		i += 1
	if i < n:
		while 2 * k < dif[i]:
			k *= 2
			ans += 1
print(ans)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = 0
curr = k
for i in a:
	if i > 2 * k:
		while k < i / 2:
			k *= 2
			s += 1
	k = max(k, i)
print(s)


(n, k) = map(int, input().split())
line = [int(x) for x in input().split()]
line.sort()
ans = 0
for i in line:
	if i > k:
		while k < i / 2:
			k = k * 2
			ans = ans + 1
		k = i
print(ans)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
num = a[-1]
ans = 0
while math.ceil(num / 2) > k:
	i = 0
	while a[i] < num:
		if a[i] >= math.ceil(num / 2):
			num = a[i]
			break
		i += 1
	else:
		num = math.ceil(num / 2)
		ans += 1
print(ans)


(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
t = 0
x = 0
while max(a) > 2 * k:
	while a[x] <= 2 * k:
		x += 1
	if x > 0:
		k = max(k, a[x - 1])
	while 2 * k < a[x]:
		k *= 2
		t += 1
print(t)


import sys
(n, max_solvable) = [int(i) for i in sys.stdin.readline().split()]
dif = [int(i) for i in sys.stdin.readline().split()]
dif.sort()
max_solvable = max_solvable * 2
i = 0
ans = 0
while True:
	while i < len(dif) and max_solvable >= dif[i]:
		max_solvable = max(max_solvable, dif[i] * 2)
		i += 1
	if i == len(dif):
		break
	ans += 1
	max_solvable *= 2
print(ans)


ans = 0
(n, k) = map(int, input().split())
d = 2 * k
arr = input()
l = list(map(int, arr.split(' ')))
l = sorted(l)
for i in l:
	if d >= i:
		d = 2 * max(k, i)
	else:
		while d < i:
			d *= 2
			ans += 1
		d = max(d, 2 * i)
print(ans)


(n, k) = map(int, input().split())
ar = sorted(list(map(int, input().split())))
ans = 0
for x in ar:
	if k <= x <= k * 2:
		k = x
	while x / 2 > k:
		ans += 1
		k *= 2
	if k <= x <= k * 2:
		k = x
print(ans)


def MultiJudge(l, p):
	count = 0
	before = True
	l.sort()
	h = [x for x in l if x <= 2 * p]
	if len(h) > 0 and max(h) > p:
		p = max(h)
	b = [x for x in l if x > 2 * p]
	while len(b) > 0:
		h = [x for x in l if x <= 2 * p]
		b = [x for x in l if x > 2 * p]
		if len(h) > 0 and max(h) > p:
			p = max(h)
			before = False
		if len(b) > 0 and before:
			p = p * 2
			count += 1
		before = True
	print(count)
p = int(input().split()[1])
l = [int(x) for x in input().split()]
MultiJudge(l, p)


(n, mx) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
cntr = i = 0
while i < n:
	if mx >= a[i] / 2:
		mx = max(mx, a[i])
		i += 1
	else:
		mx *= 2
		cntr += 1
print(cntr)


def list_input():
	return list(map(int, input().split()))

def map_input():
	return map(int, input().split())

def map_string():
	return input().split()

def dist(a, b, k):
	a = max(a, k)
	a *= 2
	cnt = 0
	while a < b:
		a *= 2
		cnt += 1
	return cnt
(n, k) = map_input()
a = list_input()
a.sort()
ans = dist(k, a[0], k)
for i in range(1, n):
	ans += dist(a[i - 1], a[i], k)
print(ans)


import sys
(n, k) = map(int, input().split())
t = list(map(int, input().split()))
for i in t:
	if i < k:
		t.remove(i)
if len(t) == 0:
	print(0)
	sys.exit()
cnt = 0
while 1:
	f = 0
	for i in t:
		if i <= 2 * k:
			t.remove(i)
			f = 1
			k = max(i, k)
	if f == 0:
		cnt += 1
		k *= 2
	if len(t) == 0:
		break
print(cnt)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
ans = 0
d = k * 2
for i in range(n):
	if d >= a[i]:
		d = max(a[i], k) * 2
	else:
		while d < a[i]:
			ans += 1
			d *= 2
		d = max(a[i], k) * 2
print(ans)


import sys

def main():
	(n, k) = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	a = sorted(a)
	ans = 0
	for i in range(n):
		if k * 2 >= a[i]:
			k = max(k, a[i])
		else:
			t = a[i]
			while t > k * 2:
				if t % 2 == 1:
					t = int(t / 2) + 1
				else:
					t = int(t / 2)
				ans += 1
			k = a[i]
	print(ans)
main()


(n, k) = list(map(int, input().split()))
v = sorted(list(map(int, input().split())))
count = 0
for cur in v:
	while 2 * k < cur:
		count += 1
		k = 2 * k
	k = max(k, cur)
print(count)


import sys
from bisect import bisect_left as lb
from collections import deque
from queue import PriorityQueue as pq
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
(n, k) = il()
a = il()
ans = 0
a.sort()
for i in a:
	while k * 2 < i:
		k = k * 2
		ans += 1
	k = max(k, i)
print(ans)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = [k]
d = 0
for i in range(n):
	c = max(b)
	if c < a[i] / 2:
		j = 1
		while True:
			if c * 2 ** j >= a[i]:
				break
			else:
				b.append(c * 2 ** j)
				d += 1
				j += 1
	b.append(a[i])
print(d)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
ka = 0
for i in range(n):
	while l[i] > 2 * k:
		k = k * 2
		ka = ka + 1
	k = max(k, l[i])
print(ka)


(n, m) = map(int, input().split())
seq = list(map(int, input().split()))
cnt = 0
seq.sort()
for x in seq:
	while m * 2 < x:
		cnt = cnt + 1
		m = m * 2
	m = max(m, x)
print(cnt)


(n, k) = map(int, input().split(' '))
problems = list(map(int, input().split(' ')))
problems.sort()
max_solved = k
problem_index = 0
n_has_to_solve = 0
while problem_index < n:
	if problems[problem_index] <= max_solved * 2:
		max_solved = max(max_solved, problems[problem_index])
		problem_index += 1
	else:
		max_solved *= 2
		n_has_to_solve += 1
print(n_has_to_solve)


import math
o = lambda : [int(f) for f in input().split()]
(n, k) = o()
a = sorted(o())
i = 0
ul = 2 * k
for x in a:
	while x > ul:
		i += 1
		ul = 2 * ul
	ul = max(ul, 2 * x)
print(i)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
answer = 0
for elem in a:
	while 2 * k < elem:
		k *= 2
		answer += 1
	k = max(k, elem)
print(answer)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, k) = value()
a = sorted(array())
ans = 0
for i in a:
	while i > 2 * k:
		ans += 1
		k *= 2
	k = max(k, i)
print(ans)


(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
from math import log
for i in a:
	if k * 2 >= i:
		k = max(k, i)
	else:
		while k * 2 < i:
			k *= 2
			ans += 1
		k = max(k, i)
print(ans)


(n, k) = map(int, input().split())
difficulties = map(int, input().split())
maxDif = k
difficulties = sorted(difficulties)
other = 0
for (index, item) in enumerate(difficulties):
	while maxDif * 2 < item:
		maxDif *= 2
		other += 1
	if maxDif < item:
		maxDif = item
print(other)


from math import ceil, floor, log2
(n, k) = map(int, input().split())
entrada = list(map(int, input().split()))
valores = sorted(entrada)
somatorio = 0
for valor in valores:
	if 2 * k < valor:
		aux = ceil(log2(valor / k)) - 1
		somatorio += aux
		k = max(k * 2 ** aux, valor)
	else:
		k = max(k, valor)
print(somatorio)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
c = 0
for aa in a:
	while aa > k * 2:
		k *= 2
		c += 1
	k = max(k, aa)
print(c)


(n, k) = list(map(int, input().split(' ')))
q = sorted(list(map(int, input().split(' '))))
result = 0
if k >= q[-1] / 2:
	print(result)
else:
	for i in q:
		while k * 2 < i:
			result += 1
			k *= 2
		k = max(k, i)
	print(result)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = [i for i in a if i > k]
a.sort()
kek = 0
for i in a:
	if k * 2 < i:
		while k * 2 < i:
			kek += 1
			k *= 2
		k = i
	else:
		k = i
print(kek)


(n, d) = map(int, input().split())
s = list(map(int, input().split()))
k = 0
for i in range(n):
	m = min(s)
	if m / 2 > d:
		while m / 2 > d:
			k += 1
			d *= 2
	if d < m:
		d = m
	s.remove(m)
print(k)


(n, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
arr.sort()
ans = 0
i = 0
while i < n:
	if arr[i] <= k:
		i += 1
	else:
		break
diff = k
for i in range(i, n):
	if diff * 2 < arr[i]:
		ans += 1
		diff <<= 1
		while diff * 2 < arr[i]:
			diff <<= 1
			ans += 1
	diff = arr[i]
print(ans)


(n, k) = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
q.sort()
ans = 0
k *= 2
for x in q:
	while x > k:
		k *= 2
		ans += 1
	k = max(2 * x, k)
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
currMax = k
count = 0
i = 0
while i < n:
	temp = (a[i] + 1) // 2
	if currMax >= temp:
		currMax = max(currMax, a[i])
		i += 1
	else:
		currMax = 2 * currMax
		count += 1
print(count)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
lvl = k * 2
cnt = 0
for i in range(n):
	while lvl < a[i]:
		lvl *= 2
		cnt += 1
	if lvl < a[i] * 2:
		lvl = a[i] * 2
print(cnt)


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
for i in range(n):
	while a[i] > 2 * k:
		k = k * 2
		ans += 1
	k = max(k, a[i])
print(ans)


(n, k) = map(int, input().split())
max_difficulty = k
problems = map(int, input().split())
problems = sorted(problems)
help_requested = 0
for problem in problems:
	if problem <= 2 * max_difficulty:
		max_difficulty = max(problem, max_difficulty)
		continue
	while problem > 2 * max_difficulty:
		help_requested += 1
		max_difficulty *= 2
	max_difficulty = max(problem, max_difficulty)
print(help_requested)


from collections import defaultdict, deque
from heapq import heappush, heappop
from math import inf
ri = lambda : map(int, input().split())

def solve():
	(n, k) = ri()
	A = list(ri())
	ans = 0
	A.sort()
	mx = k
	for i in range(n):
		if mx * 2 >= A[i]:
			mx = max(mx, A[i])
			continue
		while mx * 2 < A[i]:
			ans += 1
			mx *= 2
		mx = max(mx, A[i])
	print(ans)
t = 1
while t:
	t -= 1
	solve()


s = input().split()
n = int(s[0])
k = int(s[1])
ss = input().split()
s = sorted([int(word) for word in ss])
maxx = k
ans = 0
for diff in s:
	while maxx < diff + 1 >> 1:
		ans += 1
		maxx <<= 1
	maxx = max(maxx, diff)
print(ans)


from math import ceil, log
(n, IQ) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
	if a[i] > IQ * 2:
		x = ceil(log(a[i] / 2 / IQ, 2))
		IQ = IQ * 2 ** x
		ans += x
	IQ = max(IQ, a[i])
print(ans)