n,m = map(int,input().split())
a = [True]*(n+2)
mod = 10**9+7
for i in range(m):
    a[i] = False

dp = [0]*(n+2)
dp[0]=1

for i in range(n):
    if not a[i]:
        continue
    if a[i+1]:
        dp[i+1] += dp[i]
        dp[i+1] %= mod
    if a[i+2]:
        dp[i+2] += dp[i]
        dp[i+2] %= mod
print(dp[n]%mod)