N, M = map(int, input().split())
mod = 10 ** 9 + 7

def fibonacci(n):
  if n == 1:
    return 1
  if n == 2:
    return 2
  
  return fibonacci(n - 1) + fibonacci(n - 2)


temp = 0
pos = 0
for i in range(M):
  if pos == i:
    print(0)
    break
    
  temp += fibonacci(i - 1 - pos) % mod
  pos = i + 1
print(temp)