import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class P5518 { static Scanner in; static PrintWriter out; static String INPUT = ""; static final int mod = 1000000007; static void solve() { int n = ni(), m = ni(); int[] a = new int[n]; Arrays.fill(a, -1); State ini = new State(a, 1L, 0); Map dp = new HashMap<>(); dp.put(ini.h(), ini); // 7654 // 3210N for(int j = 0;j < m+1;j++){ for(int i = 0;i < n;i++){ Map ndp = new HashMap<>(); for(State s : dp.values()){ // 黒いセルを追加 { int[] nclus = new int[n]; for(int k = 0;k < n-1;k++)nclus[k+1] = s.clus[k]; nclus[0] = n; if(i > 0 && s.clus[0] != -1){ for(int k = 1;k < n;k++)if(nclus[k] == s.clus[0])nclus[k] = n; } if(s.clus[n-1] != -1){ for(int k = 1;k < n;k++)if(nclus[k] == s.clus[n-1])nclus[k] = n; } normalize(nclus); State ns = new State(nclus, s.val, s.hidden); add(ns, ndp); } // 白いセルを追加 { int[] nclus = new int[n]; for(int k = 0;k < n-1;k++)nclus[k+1] = s.clus[k]; nclus[0] = -1; int nhidden = s.hidden; if(s.clus[n-1] != -1) { nhidden++; for (int k = 0; k < n - 1; k++) { if (s.clus[k] == s.clus[n - 1]) { nhidden--; break; } } } if(nhidden <= 1) { normalize(nclus); State ns = new State(nclus, s.val, nhidden); add(ns, ndp); } } } dp = ndp; } } long ans = 0; outer: for(State s : dp.values()){ if(s.hidden != 1)continue; for(int i = 0;i < n;i++){ if(s.clus[i] != -1)continue outer; } ans += s.val; } out.println(ans%mod); } static int[] normalize(int[] a) { int[] label = new int[11]; Arrays.fill(label, -1); int p = 0; for(int i = 0;i < a.length;i++){ if(a[i] == -1)continue; if(label[a[i]] == -1)label[a[i]] = p++; a[i] = label[a[i]]; } return a; } static void add(State s, Map dp) { dp.merge(s.h(), s, (x, y) -> { y.val += x.val; if(y.val >= mod)y.val -= mod; return y; }); } static class State { int[] clus; long val; int hidden; // clusに現れないが、すでに現れた連結成分の個数 long h() { long h = 0; for(int v : clus){ h = h * 1000000009 + v; } h = h * 1000000009 + hidden; return h; } public State(int[] clus, long val, int hidden) { this.clus = clus; this.val = val; this.hidden = hidden; } } public static void main(String[] args) throws Exception { in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT); out = new PrintWriter(System.out); solve(); out.flush(); } static int ni() { return Integer.parseInt(in.next()); } static long nl() { return Long.parseLong(in.next()); } static double nd() { return Double.parseDouble(in.next()); } static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); } }