N, M = map(int, input().split()) if N > M: print(1) else: # N= N: dp[i] = (dp[i-1] + dp[i-N]) % mod else: dp[i] = dp[i-1] print(dp[M])