Beginner-friendly solution
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def findXSum(self, nums: List[int], k: int, x: int) -> List[int]:

        def top_x_frequent(nums, x):
            freq_map = Counter(nums)
            top_x = sorted(freq_map.items(), key=lambda x: (x[1], x[0]), reverse=True)[:x]
            result = [key * freq for key, freq in top_x]
            return result

        ans = []
        for i in range(len(nums)-k+1):
            val = nums[i:i+k]
            ans.append(sum(top_x_frequent(val, x)))             
        return ans
```
['Python3']