[python3] simple dp
\nclass Solution:\n    def sumOfPower(self, nums: List[int], k: int) -> int:\n        M=(10**9)+7\n        @cache\n        def dp(i,ok,c):\n            if ok==0
```\nclass Solution:\n    def sumOfPower(self, nums: List[int], k: int) -> int:\n        M=(10**9)+7\n        @cache\n        def dp(i,ok,c):\n            if ok==0:return (1<<(len(nums)-c))%M\n            if i>=len(nums):return 0\n            \n            a=dp(i+1,ok,c)\n            if nums[i]<=ok:a+=dp(i+1,ok-nums[i],c+1)\n            return a%M\n        \n        return dp(0,k,0)%M\n```
[]