import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class mp3_sm_naive {
	int[] p;
	boolean[] u;
	int cnt;
	int n;
	private void gen(int pos) {
		if (pos == p.length) {
			System.err.println(Arrays.toString(p));
			cnt++;
			return;
		}
		for (int i = 1; i <= n; i++) {
			if (!u[i] && (pos == 0 || i != p[pos - 1] + 1)) {
				u[i] = true;
				p[pos] = i;
				gen(pos + 1);
				u[i] = false;
			}
		}
	}

	private void solve() {
		n = in.nextInt();
		assert 2 <= n && n <= 5000;
		int m = in.nextInt();
		assert 2 <= m && m <= 1e9;
		p = new int[n];
		u = new boolean[n + 1];
		gen(0);
		out.println(cnt);
	}

	Scanner in;
	PrintWriter out;

	void run() {
		try {
			in = new Scanner(new File("mp3.in"));
			out = new PrintWriter("mp3.out");
			solve();
			out.close();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

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

}
