import itertools


def countCombosSumEqual(sm: int, nums: list) -> int:
    """
    Count all possible combos of elements in nums[] such that sum(combo) == sm

    Args:
        sm (int): the sum to match.
        nums (list): list of positive integers.

    Returns:
        int: resulting count.

    If nums[0] == sm, start with count=1, then pop nums[0]
    For r from 2 to len(nums), iterate thru all combos C(len(nums), r),
    then count all such that sum(combo) == sm
    """
    count = 0
    if nums[0] == sm:
        count += 1
        nums.pop(0)
    return count + len([1 for r in range(2, len(nums) + 1)
                        for combo in itertools.combinations(nums, r)
                        if sum(combo) == sm])