Implementing Invoke Code Activity for a code which includes recursion

I have a VB Code which includes recursive function and I need to implement it in Invoke code activity.
I need to pass two inputs i.e. a list and an integer value and want to get another list which is generated after calculations as output from the activity.

The code is as below:

Public Shared Sub Main(ByVal args As String())
Dim numbers As List(Of Integer) = New List(Of Integer)() From {3, 9, 8, 4, 5, 7, 10}
Dim target As Integer = 15
sum_up(numbers, target)
End Sub

Private Shared Sub sum_up(ByVal numbers As List(Of Integer), ByVal target As Integer)
sum_up_recursive(numbers, target, New List(Of Integer)())
End Sub

Private Shared Sub sum_up_recursive(ByVal numbers As List(Of Integer), ByVal target As Integer, ByVal [partial] As List(Of Integer))
Dim s As Integer = 0
For Each x As Integer In [partial]
s += x
Next

If s = target Then
    Console.WriteLine("sum(" & String.Join(",", [partial].ToArray()) & ")=" + target)
    System.Environment.[Exit](0)
End If

If s >= target Then Return
For i As Integer = 0 To numbers.Count - 1
    Dim remaining As List(Of Integer) = New List(Of Integer)()
    Dim n As Integer = numbers(i)
    For j As Integer = i + 1 To numbers.Count - 1
        remaining.Add(numbers(j))
    Next

    Dim partial_rec As List(Of Integer) = New List(Of Integer)([partial])
    partial_rec.Add(n)
    sum_up_recursive(remaining, target, partial_rec)
Next

End Sub

Here the numbers and target variables needs to be passed as arguments in invoke code activity.
And after the condition if s=target comes true, the partial list should be sent as output from the invoke code activity.