All Tracks Algorithms Dynamic Programming Introduction to Dynamic Programming 1 Problem

Jumping stones
/

Algorithms, Dynamic Programming, Introduction to Dynamic Programming 1

Problem
Editorial
Analytics

There are \(n\) stones in a row from left to right. You are standing on the first stone. From every step from stone number \(i\), you can jump at most \(k\) stones further (\(i + 1,\ i + 2,\ \dots,\ i + k\)). You cannot jump over stone number \(n\). How many ways are there to travel to stone number \(n\)?

Input format

First line: \(n\) and \(k\)

Output format

Print the answer modulo \(10^9+7\).

SAMPLE INPUT
5 2

SAMPLE OUTPUT
5
Explanation

-

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?