#include <stdio.h>
#include <string.h>

//1.至少有一个空盘fm,n = fm,n-1
//2.一个空盘都没有fm,n = fm-n,n;
//m个果放1个盘子 1种
//0个果放n个盘子 1钟

int f(int m, int n);
 int main()
{
    int m, n;
     while (scanf("%d %d", &m, &n) != EOF)
    {
        printf("%d\n", f(m, n));
    }

    return 0;
}

int f(int m, int n)
{
    int ret;
    if (n == 1)
    {
        ret = 1;
    }
    else if (m == 0)
    {
        ret = 1;
    }
    else if (m < n)
    {
        ret = f(m,m);
    }
    else if (m >= n)
    {
        ret = f(m - n, n) + f(m, n - 1);
    }

    return ret;
}