import sympy


def integer_partitions(target, nb_ele):
    """
    return all possible ways to sum to target using nb_ele, allowing 0 to be one of the element

    for example, integer_partitions(4, 2) returns
    ([0,4], [4,0], [1,3], [3,1], [2,2])
    """
    if target == 0:
        return [[0] * nb_ele]

    ans = []
    for i in range(nb_ele):
        for part in sympy.utilities.iterables.ordered_partitions(target, m=i+1):
            arr = [0] * (nb_ele - (i + 1)) + part
            for j in sympy.utilities.iterables.multiset_permutations(arr):
                ans.append(j)
    return ans