#include <iostream>
#include <stdlib.h>
#include <stdio.h>

typedef long long ll;

using namespace std;

ll get(long m,long n){
  ll ans = 1;
  for(long i = 0; i < n; i++){
      ans*=m-i;
      ans/=(i+1);
  }
  return ans;
}

int main()
{
//    printf("%lld\n", get(1, 0));
    ll l, k;
    scanf("%lld%lld", &l, &k);
    {
        if(k > l) printf("%lld\n", (l+1)/2);
        else if(k == l) printf("%lld\n", (l+1)/2+1);
        else if(k < l)
        {
            ll sum = 0;
            //普通底
            ll le = l-1;//剩余长度
            ll thick = le/(k+1);//厚块个数

            for(ll i = 0; i <= thick; i++)
            {
                ll le_ = (le-i*(k+1))/2;//剩余普通块数
                for(ll j = 0; j <= le_; j++)
                {
                    sum += get((j+i), i);
                }
            }

            //厚底
            le = l-k;//剩余长度
            thick = le/(k+1);//厚块个数

            for(ll i = 0; i <= thick; i++)
            {
                ll le_ = (le-i*(k+1))/2;//剩余普通块数
                for(ll j = 0; j <= le_; j++)
                {
                    sum += get((j+i), i);
                }
            }
            printf("%lld\n", sum);
        }
    }



    return 0;
}

