the explanation was not clear.
Bad explanation of the algorithm
hello @bansal_surya
the idea is to compute distances for all k size window.
and then pick that window whose distance from x is minimum.
distance for any k size window from x will be-> absolute value of ( summation of all elements in the window - k * x).
by k size window i mean k size contiguos subarray