#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  ll l, k;
  cin >> l >> k;
  vector<vector<ll> > dp(2, vector<ll>(l + 1, 0));
  dp[0][0] = 1;
  //dp[next_is_white][height] = number
  for(int from = 0;from<l;from++){
    for(int black = 0;black<=1;black++){
      dp[1-black][from + 1] += dp[black][from];
      if(black == 0 && from + k <= l)
	dp[1-black][from + k] += dp[black][from];
    }
  }
  ll ans = 0;
  for(int i=1;i<=l;i++){
    ans += dp[1][i];
    //cout << "i:" << dp[1][i] << endl;
  }
  cout << ans << endl;
  return 0;
}