Getting Tle in this question

Hello…
I am solving this question from hackerearth…

The logic i have applied is that first i have calculated the number of ways to go to k steps using atmost k steps…
Now after that… I have counted the number of steps to go till ‘X’ … Now this O(X) solution… as i have used prefix sum then also it is showing TLE…
How should i fix this…
This is my submission…
https://www.hackerearth.com/submission/51424329/
Please see this.
Thanks…

Hello @ashishnnnnn you can see this from discussion of this page

i will also checl and tell you.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.