A noob approach
Intuitionused pen and paper to solve this and took one dayApproachone step at a time , and I got to know I need to learn dict,lambda againComplexity

Time compl
# Intuition
used pen and paper to solve this and took one day

# Approach
one step at a time , and I got to know I need to learn dict,lambda again

# Complexity
- Time complexity:
I don't know.

- Space complexity:
I don't know.

# Code
```python3 []
class Solution:
    def findXSum(self, nums: List[int], k: int, x: int) -> List[int]:
        listmain=[]
        for i in range(len(nums)-k+1):
            listnums=[]
            for j in range(i,i+k):
                listnums.append(nums[j])
            listmain.append(listnums)
        mainans=[]
        for k in listmain:
            minidict={}
            for j in k:
                minidict[j] = k.count(j)            
            mainans.append(minidict)
        newmain = []
        for r in mainans:
            newmain.append(dict(sorted(r.items(),key = lambda item: (item[1], item[0]),reverse=True)))
        itslast=[]
        for t in newmain:
            newt=list(t.items())
            minilastans=[]
            for z in newt[:x] :
                minilastans.append(z[0]*z[1])
            itslast.append(sum(minilastans[:x]))
        return itslast       

        




```
['Python3']