My issue
Not being able to figure out where is code going wrong…not able to get desired output
My code
# cook your dish here
t =int(input())
for i in range(t):
n,k = map(int,input().split())
a= list(map(int,input().split()))
days=0
temp1=0
for j in a:
if ((j+temp1)-k)>=0 :
temp1=j-k
days+=1
if days==n:
print('YES')
else:
x=(a.index(j))+1
print(f'NO {x}')
break
Problem Link: DIET Problem - CodeChef