import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { new Main().run(); } final long MOD = (long) 1e9 + 7; long[] fac = new long[2000000]; long[] ifac = new long[2000000]; long[] inv = new long[2000000]; { fac[0] = ifac[0] = inv[0] = fac[1] = ifac[1] = inv[1] = 1; for (int i = 2; i < fac.length; ++i) { fac[i] = fac[i - 1] * i % MOD; } // 0 = p/i*i + (p%i) for (int i = 2; i < inv.length; ++i) { inv[i] = MOD - inv[(int) (MOD % i)] * (MOD / i) % MOD; } for (int i = 2; i < ifac.length; ++i) { ifac[i] = inv[i] * ifac[i - 1] % MOD; } } long comb(int n, int k) { return fac[n] * ifac[k] % MOD * ifac[n - k] % MOD; } void run() throws Exception { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); if (N == 1) { System.out.println(1); return; } long ans = 0; int[] a = new int[M + 2]; a[0] = 1; for (int i = 1; i <= N; ++i) { for (int j = 0; i + j < a.length; j += 2 * N) { a[i + j] = i; if (i + j + N < a.length) a[i + j + N] = N + 1 - i; } } for (int i = 1; i < a.length; ++i) { if (a[i] != 1) continue; for (int d = 0; d <= 1; ++d) { int r = i - d; if (r % 2 != M % 2) continue; if (M - r < 0) continue; int l = (M - r) / 2; r += l; ans = (ans + comb(l + r, l)) % MOD; } } System.out.println(ans); } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }