JAVA 100% using DP
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```\nclass Solution {\n    final int mod = 1_000_000_007;\n    public int sumOfPower(int[] ns, int k) {\n        long[] p = new long[101];\n        int[][] d = new int[k+1][k+1];\n        d[0][0]=1;\n        for(int n:ns){\n            if(n>k)continue;\n            for(int c=k; c>=1; c--){\n                for(int s=k; s>=n; s--){\n                    d[c][s]=(d[c][s]+d[c-1][s-n])%mod;\n                }\n            }\n        }\n        long ans=0L;\n        for(int c=1; c<=k; c++){\n            if(d[c][k]!=0){\n                ans = (ans + (d[c][k]%mod)*(power(ns.length-c, p)%mod))%mod;\n            }\n        }\n        return (int)ans;\n    }\n    private long power(int c, long[] p){\n        if(p[c]>0)return p[c];\n        if(c==1)return p[c]=2;\n        else if(c==0)return p[c]=1;\n\n        return p[c] = (((power(c/2, p)*power(c/2, p))%mod)* (c%2==1? 2:1))%mod;\n    }\n}\n```
['Java']