input: from typing import List
  
  def calculate_power_sums(nums: List[int], k: int) -> int:
      """
      Given a list of integers nums with length n and a positive integer k, calculate the power of the array.
  
      The power of an integer list is the count of subsequences whose sum is exactly k.
  
      Return the total power of all subsequences in nums.
  
      As the result can be very large, return it modulo 10^9 + 7.
  
      Examples:
      >>> nums = [1,2,3], k = 3
      6
      >>> nums = [2,3,3], k = 5
      4
      >>> nums = [1,2,3], k = 7
      0
  
      Constraints:
      1 <= n <= 100
      1 <= nums[i] <= 10^4
      1 <= k <= 100
      """
output:     
      MOD = 10**9 + 7
  
      def count_subsequences(nums, n, k):
          dp = [[0] * (k + 1) for _ in range(n + 1)]
          dp[0][0] = 1
  
          for i in range(1, n + 1):
              for j in range(k + 1):
                  dp[i][j] = dp[i - 1][j]
                  if j >= nums[i - 1]:
                      dp[i][j] = (dp[i][j] + dp[i - 1][j - nums[i - 1]]) % MOD
          return dp[n][k]
  
      result = 0
      n = len(nums)
  
      # Calculate for all subsequences
      for i in range(1, 1 << n):
          sub_seq_sum = sum(nums[j] for j in range(n) if i & (1 << j))
          if sub_seq_sum == k:
              result += 1
  
      return result % MOD
  