Simple solution
\n\nclass Solution {\n    int mod=(int)1e9+7;\nLong[][][]dp=new Long[101][101][101];\n    public int sumOfPower(int[] nums, int k) {\n     long ans=0;\n     lon
\n```\nclass Solution {\n    int mod=(int)1e9+7;\nLong[][][]dp=new Long[101][101][101];\n    public int sumOfPower(int[] nums, int k) {\n     long ans=0;\n     long[]p=new long[nums.length+1];\n     p[0]=1;\n   //  Arrays.sort(nums);\n     for(int i=1;i<=nums.length;i++){\n       p[i]=(p[i-1]*2)%mod;\n     }\n     for(int i=1;i<=nums.length;i++){\n       long t=f(0,nums,k,i);\n        ans=(ans+(p[nums.length-i]*t)%mod)%mod;\n     }\n      return (int)ans;\n    }\n    public long f(int idx,int[]nums,int s,int l){\n        if(idx==nums.length){\n          if(s==0&&l==0){\n            return 1;\n          }\n         else{\n             return 0;\n         }\n        }\n        if(l<0){\n            return 0;\n        }\n         if(s<0){\n            return 0;\n        }\n        if(dp[idx][s][l]!=null)return dp[idx][s][l];\n        long ans=0;\n        ans=f(idx+1,nums,s,l);\n        ans=(ans+f(idx+1,nums,s-nums[idx],l-1))%mod;\n        return dp[idx][s][l]=ans;\n    }\n}\n```
['Java']