Given an array of size N contains A[i] 0<=i<N, and given a value X we need to calculate the total number of ways to reach X by doing the sum of any elements of the array any number of times.

constraints:

1<=N<=10^5

1<=X<=10^9

1<=A[i]<=10^2

I tried to do this by using dp concept of the coin change problem but I think that will not work due to the constraints is there any other optimized solution?

Can you give the link to the question.

It was a hiring round they do not provide questions for practice this is all that I can remember.