Simple solution using counter and heap
Code

# Code
```python3 []
class Solution:
    def findXSum(self, nums: List[int], k: int, x: int) -> List[int]:
        from collections import Counter
        import heapq
        i=0
        ans=[]
        n=len(nums)-k+1
        while n:
            c=Counter(nums[i:i+k])
            
            hps=[]
            for key, v in c.items():
                heapq.heappush(hps,(-v,-key))
            s=0
            for j in range(x):
                if hps:
                    v,key=heapq.heappop(hps)
                    s+=(v*key)
            ans.append(s)
            i+=1
            n-=1
        return ans
                

        
        
```
['Heap (Priority Queue)', 'Python3']