using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, m) = (c[0], c[1]); var dp = new long[n * 2 + 1][][]; for (var i = 0; i < dp.Length; ++i) { dp[i] = new long[n + 1][]; for (var j = 0; j < dp[i].Length; ++j) dp[i][j] = new long[n * n + 1]; } dp[0][0][0] = 1; for (var i = 0; i + 1 < dp.Length; ++i) { for (var j = i % 2; j < dp[i].Length && j <= i; j += 2) { for (var k = 0; k < dp[i][j].Length; ++k) { if (dp[i][j][k] == 0) continue; if (j + 1 < dp[i].Length) dp[i + 1][j + 1][k + (i - j) / 2] = (dp[i + 1][j + 1][k + (i - j) / 2] + dp[i][j][k]) % m; if (j > 0) dp[i + 1][j - 1][k] = (dp[i + 1][j - 1][k] + dp[i][j][k]) % m; } } } WriteLine(string.Join("\n", dp[^1][0])); } }