1513
import java.util.Scanner;
import java.math.BigInteger;
import java.util.*;
 
public class Kbase
{    
 
    public static void main(String[] args)
    {
        int N,K;
 
        BigInteger m[] = new BigInteger[100001];
        BigInteger c = new BigInteger("0");
        BigInteger a = new BigInteger("1");
 
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        K = sc.nextInt();
 
        if( K == 0)
        {
            System.out.println("1");
            return;
        }
 
        for( int i = 0; i <= K; i++)
        {
            c = c.add(a.shiftLeft(i));
            m[i] = a.shiftLeft(i);
//            System.out.println(m[i].toString());
        }
 
        for( int i = K+1; i <= N; i ++)
        {
            m[i] = c;
 
            c = c.subtract(m[i-K-1]);
            c = c.add(m[i]);
//            System.out.println(m[i].toString());
        }
 
        System.out.println(m[N].toString());
    }
 
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.