Iterative DP solution
Intuition\nmaximum length of subsequences can only be n, so if we know for a particular length t how many subsequences are there that sums upto k we can easily 
# Intuition\nmaximum length of subsequences can only be n, so if we know for a particular length t how many subsequences are there that sums upto k we can easily calculate how many supersequnces(subsequnces that contains subsequence suming upto k) for that subsequence by using formula:\n2^(n-t) for each count of that subsequence of length t that is total will be p(number of subsequence of length t with sumk)*2^(n-t)\n\n# Approach\ndp[i][j][x] denotes number total no. of subsequences upto i with length j that sums upto  x,\ntherefore recurrenece relation will be:\ndp[i][j][x]=dp[i-1][j-1][x-nums[i]]+dp[i-1][j-1][x]\n# Complexity\n- Time complexity:\nO(n^3)\n\n- Space complexity:\nO(n^3) reducible upto O(n^2)\n\n# Code\n```\nclass Solution:\n    def sumOfPower(self, nums: List[int], k: int) -> int:\n        \n        n=len(nums)\n        mod=10**9+7\n        dp=[[[0 for i in range(k+1)] for j in range(n+1)] for t in range(n)]\n        \n        \n        #precal\n        for i in range(n):\n            if nums[i]<=k:\n                dp[i][1][nums[i]]=1\n        \n        for i in range(1,n):\n            for length in range(1,n+1):\n                for su in range(k+1):\n                    if su-nums[i]>0:\n                        dp[i][length][su]+=dp[i-1][length-1][su-nums[i]]\n                    dp[i][length][su]+=dp[i-1][length][su]\n        \n        ans=0\n        for i in range(n+1):\n            \n            if dp[n-1][i][k]>0:\n                # print(dp[n-1][i][k])\n                ans+=dp[n-1][i][k]*(2**(n-i))\n        return ans%mod\n            \n        \n                    \n        \n```
['Python3']