C++ solution
\n\n# Approach\n Describe your approach to solving the problem. \nExplained through comments in code itself.\n\n# Complexity\n- Time complexity:\n Add your time
\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nExplained through comments in code itself.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n*k)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n*k)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int sumOfPower(vector<int>& nums, int k) {\n        // dp[i][x] : represent the sum of power of all subsequences from first\n        // i elements with sum required to be x\n\n        // if I am not taking nums[i-1] into consideration for sum purpose then\n        // dp[i][x] = 2*dp[i-1][x] , dp[i-1][x] when nums[i-1] is present in\n        // subsequence and another dp[i-1][x] when nums[i-1] is not present in\n        // subsequence\n\n        // if I am taking nums[i-1] to consider for sum purpose then\n        // dp[i][x] = dp[i-1][x-nums[i-1]];\n\n        int n = nums.size(), mod = 1e9 + 7;\n        vector<vector<int>> dp(n + 1, vector<int>(k + 1, 0));\n        dp[0][0] = 1; // because there is only one subsequence possible with no\n                      // element whose sum will be zero.\n        // dp[0][x] = 0 , because there is only one subsequence possible with no\n        // element and will have sum == 0, so 0 way to have sum > 0,\n        for (int i = 1; i <= n; i++) {\n            for (int x = 0; x <= k; x++) {\n                dp[i][x] = (2 * dp[i - 1][x]) % mod;\n                if (x >= nums[i - 1])\n                    dp[i][x] = (dp[i][x] + dp[i - 1][x - nums[i - 1]]) % mod;\n            }\n        }\n        return dp[n][k];\n    }\n};\n```
['C++']