Chey and way

def minproduct(a,u):
mi = float(‘inf’)
if len(a) == 1:
return a[0]
else:
for j in range(1, len(a)) :

        if 1<=a[j]-a[0]<=u:
        
             mult=a[0]*minproduct(a[j:],u) 
             if mult<=mi:
                    mi = mult
if mi== float('inf'):
    return a[0]*a[-1]
else:
            
     return mi

c, k= map(int, input(). split())
d =list(map(int, input(). split()))
print((minproduct(d,k))%(1000000007) )

Please verify my code
I got wrong as output