#MOWGLI. Time for Revenge
Time for Revenge
Mowgli is a little boy brought up by a wolf pack in the jungle. The king of jungle Shere Khan wants the boy for revenge. Foreseeing his danger Akela the leader of wolf pack suggests Mowgli to leave the jungle. Before Mowgli's departure from jungle, he got the news that Shere Khan killed Akela. So Mowgli wants revenge. He wants to get back to Shere Khan's palace in shortest path.
There are N number of rivers in his path. Width of each river is atmost 105 meters. To cross the river stones are kept at a distance of 1 meter. Mowgli can jump across atmost K stones at a time. Given total number of stones Ai kept on the ith river. Your job is to tell total number of ways Mowgli can cross each river. As answer can be very large Give output modulo 1000000007.
Input
There are around 10 test cases.
First line contains an integer T number of test cases
Each test case consists of two lines:
First line contains two integers N(Number of rivers) and K(Maximum number of stones Mowgli can skip).
Next line contains N integers. Ai (Number of stone kept on ith river).
Output
One line for each river.
Total number of ways Mowgli can cross the river.
Constraints:
T <= 10
1 <= N <= 100
0 <= K <= 50
0 <= Ai <= 100000
Example
Input: 1
2 1
1 2</p>Output:
2 3
Explanation:
For second river with 2 stones. Mowgli can jump across 1 stone maximum at a time. So there are three choices
1. Start --> 1st --> 2nd --> Destination
2. Start --> 1st --> Destination
3. Start --> 2nd --> Destination