SOLVE
LATER
Queen of the Andals and the First Men, Protector of the Seven Kingdoms , Cersei Lannister is preparing her army for the upcoming Great War. Cersei’s city consists of ‘N’ citizens, she orders all of them to come and makes them stand in a line. Now, each citizen has some strength denoted by Ai, Ai can be positive, negative or zero (negative and zero for the old ones and children).
Little Finger has already found out about the average strength of the enemy’s army M, through his infamous spy birds.
Cersei calls a sequence of citizens A[L..R] Eligible for war, if the average of their strengths Ai, L<=i<=R is greater than or equal to M. Cersei is quite busy in preparing the strategy to tackle the mighty dragons, so she asks for your help in this difficult time.
Average of A[L..R] = (Sum of Ai's for all L<=i<=R) / (R-L+1)
You need to find the number of sequences of citizens which are Eligible for war.
Input :
First line consists of an integer T, no. of test cases.
For each test case, there will be two lines;
first line contains two spaces separated integers N, M i.e. the number of citizens, and average strength of the enemy’s army respectively.
The next line contains N, space separated integers Ai, where i’th integer denotes strength of i’th citizen.
Output :
For each test case, a single new line consisting of an integer which denotes the number of sequences of citizens (A[L..R]) which are Eligible for war.
Constraints :
The strength of the citizens are A[4] = {1,2,0,-1} and M = 1. Here, 5 sequences have their average greater than or equal to 1. The sequences are as follows: