#include typedef long long ll; using namespace std; int N, M; const int MOD = 1e9 + 7; ll memo[10001][1001][2]; ll flowers(int last, int count = 1, int size = 1) { if (size == N) return 1; /* if sequences ends with X we have to cases: if count(X) < M we can continue the sequence by appending another X in its end we can also start and entirely new sequence starting with Y. */ if (memo[size][count][last] == 0) { if (last == 0) { if (count < M) memo[size][count][0] += flowers(0, count + 1, size + 1); memo[size][count][0] += flowers(1, 1, size + 1); } else { if (count < M) memo[size][count][1] += flowers(1, count + 1, size + 1); memo[size][count][1] += flowers(0, 1, size + 1); } } return memo[size][count][last] %= MOD; } int main(){ cin >> N >> M; memset(memo, 0, sizeof(memo)); cout << (flowers(0) + flowers(1)) % MOD << endl; return 0; }