#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "vector"
#include "string"
#include "map"
#include "algorithm"
#include "functional"
#include "set"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> K;
	vector<long long int>dp(N + 1);
	dp[1] = 1;
	if (K <= N)dp[K] = 1;
	for (int i = 1; i <= N; i++) {
		if (i + 2 <= N) {
			dp[i + 2] += dp[i];
		}
		if (i + K + 1 <= N)dp[i + K + 1] += dp[i];
	}
	cout << accumulate(dp.begin(), dp.end(), 0LL) << endl;
	return 0;
}
