import java.io.*;
import java.util.*;
import java.math.*;

public class design_aa {
	public static void main(String[] args) {
		new design_aa().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	void myAssert(boolean u, String message) {
		if (!u) {
			throw new Error("Assertion failed!!! " + message);
		}
	}

	int inBounds(int x, int l, int r, String name) {
		myAssert(l <= x && x <= r, name + " is not in bounds: " + x
				+ " not in [" + l + ", " + r + "]");
		return x;
	}

	String FNAME = "design";

	private void solve() throws IOException {
		int n = nextInt();
		m = nextInt();
		genAllProfs(0, m, new int[m], new int[m]);
		a = new int[hm.size()][hm.size()];
		for (Prof p : al) {
			int[] used = new int[m];
			int s = 0;
			for (int i = 0; i < p.size.length; i++) {
				if (p.shift[i] + 1 < p.size[i]) {
					for (int j = 0; j < p.size[i]; j++) {
						used[s + j] = p.shift[i] + 1;
					}
				}
				s += p.size[i];
			}
			genAllMoves(0, used, p);
		}
		// for (int i = 0; i < a.length; i++) {
		// for (int j = 0; j < a[i].length; j++) {
		// System.out.print(a[i][j] + " ");
		// }
		// System.out.println();
		// }
		long[][] d = new long[n + 2][hm.size()];
		d[0][0] = 1;
		for (int i = 0; i + 1 < d.length; i++) {
			for (int j = 0; j < d[i].length; j++) {
				if (d[i][j] > 0) {
					for (int k = 0; k < a[j].length; k++) {
						d[i + 1][k] = (d[i + 1][k] + d[i][j] * a[j][k]) % mod;
					}
				}
			}
		}
		out.println(d[n + 1][0]);
	}

	int m;

	long mod = 1000000007;

	int[][] a;

	private void genAllMoves(int i, int[] used, Prof p) {
		if (i >= used.length) {
			int k = 0;
			int q = 0;
			int s = 0;
			int[] size = new int[m];
			int[] shift = new int[m];
			for (int j = 0; j < p.size.length; j++) {
				s += p.size[j];
				if (p.shift[j] + 1 < p.size[j]) {
					size[q] = p.size[j];
					shift[q] = p.shift[j] + 1;
					k += size[q];
					q++;
				} else {
					// System.out.println(Arrays.toString(used) + " "
					// + Arrays.toString(size));
					while (k < s) {
						size[q] = -used[k];
						shift[q] = 0;
						k -= used[k];
						q++;
					}
				}
			}
			Prof pp = new Prof(size, shift, q);
			int j = hm.get(pp);
			a[p.num][j]++;
			return;
		}
		if (used[i] != 0) {
			genAllMoves(i + 1, used, p);
			return;
		}
		int r = i + 1;
		while (r < used.length && used[r] == 0) {
			r++;
		}
		insert(i, r, used, p);
	}

	private void insert(int l, int r, int[] used, Prof p) {
		if (l == r) {
			genAllMoves(r, used, p);
			return;
		}
		for (int size = 1; size <= r - l; size++) {
			for (int j = 0; j < size; j++) {
				used[l + j] = -size;
			}
			insert(l + size, r, used, p);
			for (int j = 0; j < size; j++) {
				used[l + j] = 0;
			}
		}
	}

	HashMap<Prof, Integer> hm = new HashMap<design_aa.Prof, Integer>();
	ArrayList<Prof> al = new ArrayList<design_aa.Prof>();

	private void genAllProfs(int i, int m, int[] size, int[] shift) {
		if (m == 0) {
			addNewProf(size, shift, i);
			return;
		}
		for (size[i] = 1; size[i] <= m; size[i]++) {
			for (shift[i] = 0; shift[i] < size[i]; shift[i]++) {
				genAllProfs(i + 1, m - size[i], size, shift);
			}
		}
	}

	private void addNewProf(int[] size, int[] shift, int i) {
		Prof p = new Prof(size, shift, i);
		al.add(p);
		p.num = hm.size();
		hm.put(p, hm.size());
	}

	class Prof {
		int[] size;
		int[] shift;
		int num;
		int hash;

		public Prof(int[] size2, int[] shift2, int n) {
			size = new int[n];
			for (int i = 0; i < n; i++) {
				size[i] = size2[i];
			}
			shift = new int[n];
			for (int i = 0; i < n; i++) {
				shift[i] = shift2[i];
			}
			hash = Arrays.hashCode(size) * 999997 + Arrays.hashCode(shift);
		}

		@Override
		public int hashCode() {
			return hash;
		}

		@Override
		public boolean equals(Object o) {
			if (!(o instanceof Prof)) {
				return false;
			}
			Prof p = (Prof) o;
			if (hash != p.hash) {
				return false;
			}
			for (int i = 0; i < size.length; i++) {
				if (size[i] != p.size[i] || shift[i] != p.shift[i]) {
					return false;
				}
			}
			return true;
		}
	}
}
