Edtorial request for Spoj K Query II

Can anyone provide a detail editorial to solve spoj k query II SPOJ.com - Problem KQUERY2

If anyone solved this problem using sqrt decompositon + BIT. please give me idea how to solve it using sqrt decomposition + BIT