#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

long long c[100][100];	//combination


int main(){
	int l,k;
	scanf("%d %d", &l, &k);

	long long ans = 0;

	for(int i=0;i<100;i++){
		c[i][0] = 1;
		c[i][i] = 1;
	}
	for(int i=1;i<100;i++){
		for(int j=1;j<i;j++){
			c[i][j] = c[i-1][j] + c[i-1][j-1];
		}
	}

	/*
	 *  x : number of dark thin disk
	 *  y : number of dark k cm dick
	 *  	-> number of white thin disk = x + y - 1
	 * 		answer is sum of (x+y C x)
	 *  1*x + (k+1)*y + 1*(x+y-1) <= l
	 *  	-> y <= (l+1-2*x)/(k+1)
	 *
	 */

	for(int x=0;l+1>=2*x;x++){
		int y = (l+1-2*x)/(k+1);
		for(int z=0;z<=y;z++){
			if(x!=0 || z!=0) ans += c[x+z][x]; // add x+z C x
		}
	}

	printf("%lld\n",ans);

	return 0;
}