My approach was to factorize ‘P’ and as it is small to brute force over all combinations of divisors.
For example for S=11, P=48 and k=3 (Shown example) I would check (1,1,48),(1,2,24),(1,3,16) and so on till i reached (3,4,4) which was the answer. Could someone suggest some method to enumerate all the sets of the divisors of the number?

The base case being, if K = 1, then if S = P, the answer is yes, otherwise no.

Basically you are reducing the actual problem to the following sub problem.

You’re given S, P, K.

if K=1
if S=P
return true i.e. answer is yes
else
return false i.e. answer is no
For i = 1 to N
If P is divisible by i,
Include i in list of numbers
then solve for S-i, P/i and K-1 recursively

About the test data, there’s extra information missing in the problem statement. Nothing about the ordering of the numbers N1, N2, …, NK has been explicitly mentioned in the problem statement. That is:

If one of N1, N2, …, NK is 1, print in descending order. Otherwise, print the numbers in ascending order.