T=int(input())
l=[]
while T!=0:
cou=0
N,M=input().split()
inp = list(map(int,input().split()))
for i in range(len(inp)):
for j in range(i+1,len(inp)):
sub=inp[i:j]
if(len(sub)==0 or len(sub)==len(inp)):
break
else:
s=0
for k in sub:
s=s+k
if(s%int(M)==0):
cou=cou+1
T=T-1
l.append(cou)
for i in l:
print(i)
for input: 1 4 3 1 2 2 3 output for my code is: 2 but other code the output is 1 what wrong with my code.