#include <iostream>
using namespace std;
int f(int n, int m) {
if (n == 0 || n == 1 || m == 1) {
return 1;
}
if (n < m) {
return f(n, n);
}
return f(n - m, m) + f(n - 1, m);
}
int main() {
int n = 0, m = 0;
cout << "please input the number of ball and box:" << endl;
cin >> n >> m;
int ans = f(n, m);
cout << "ans = " << ans << endl;
return 0;
}