Tilling proble 2

import java.util.Scanner;

public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
long t = cin.nextLong();
while (t > 0) {
long n = cin.nextLong(), m = cin.nextLong();
long res = noOfWays(n, m);
res = res % (((int) Math.pow(10, 9)) + 7);
System.out.println(res);
t–;
}
}

public static long noOfWays(long n, long m) {
	long count[] = new long[(int)n + 1];
	count[0] = 0;
	for (int i = 1; i < count.length; i++) {
		if (i == m) {
			count[i] = 2;
		} else if (i < m) {
			count[i] = 1;
		} else {
			count[i] = count[i - 1] + count[i -(int) m];
		}
	}
	return count[(int)n];
}

}----I have made the changes but still only one test case is correct please make the corrections and point out them

use %mod function for result and count array also just incase it might overflow.
i have made the changes and commented it.

@AbhishekAhlawat1102 please mark your doubt as resolved if you are satisfied with the answer