Clear Py3 solution
Code\n\nfrom sortedcontainers import SortedList\n\nclass Solution:\n    def kSum(self, nums: List[int], k: int) -> int:\n        ps = sum([x for x in nums if x 
# Code\n```\nfrom sortedcontainers import SortedList\n\nclass Solution:\n    def kSum(self, nums: List[int], k: int) -> int:\n        ps = sum([x for x in nums if x >= 0])\n        al = sorted([x if x >= 0 else -x for x in nums])\n        # print(al)\n        q = SortedList()\n        q.add((ps, 0))\n        \n        for i in range(k):\n            # print(q, q[-1])\n            s, idx = q.pop()\n            # print(s)\n            for j in range(idx, min(len(al), idx + k)):\n                if len(q) > k and s - al[j] < q[-k][0]:\n                    break\n                q.add((s - al[j], j + 1))\n        return s\n        \n```
['Python3']