best  solution just  using the  including and excluding logic and dp  and only  small  trick
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#define  ll long long  \nclass Solution {\npublic:\n    int mod =  1000000007 ;\n    int solve(vector<int>& nums , int total ,  int index ,map<int ,int>&op , int len ,  vector<vector<int>>&dp ){\n        if (index >= nums.size()) {\n            if (total == 0) {\n               \n                return 1;\n            }\n            return 0;\n        }\n        if(total < 0){\n            return 0 ;\n        }\n        if(dp[index][total] != -1){\n            return dp[index][total] ;\n        }\n\n        int include = solve(nums, total - nums[index], index + 1,op , len + 1 , dp);\n        int exclude = solve(nums, total, index + 1,op , len , dp);\n\n        dp[index][total]  = (include%mod +  2*exclude%mod )%mod ;\n\n        return dp[index][total]%mod ; \n\n    }\n    int sumOfPower(vector<int>& nums, int k) {\n        int total = k ;\n        int  index = 0 ;\n        map<int ,int>op ;\n        int len = 0 ;\n        vector<vector<int>>dp(nums.size()+1  , vector<int>(k+1 , -1)) ;\n        ll as = solve(nums ,  total  , index , op , len , dp) ;\n       \n        if(as==-1){\n            return 0 ;\n        }\n        return as%mod ;\n        \n    }\n};\n```
['C++']