package Test;
import java.io.*;
import java.util.Scanner;
class Test {
// function to count the total number of ways
static int countWays(int n, int m)
{
// table to store values
// of subproblems
int count[] = new int[n + 1];
count[0] = 0;
// Fill the table upto value n
int i;
for (i = 1; i <= n; i++) {
// recurrence relation
if (i > m)
count[i] = count[i - 1] + count[i - m];
// base cases
else if (i < m || i == 1)
count[i] = 1;
// i = = m
else
count[i] = 2;
}
// required number of ways
return count[n];
}
// Driver program
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
System.out.println(countWays(n, m));
}
}