#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, mod;
int dp[510][510][510];
int main() {
    freopen("tree.in", "r", stdin);
    freopen("tree.out", "w", stdout);
    scanf("%d%d", &n, &mod);
    for (int i = 0; i <= n; i++) {
        dp[1][1][i] = i;
    }
    printf("%d\n", 1);
    for (int i = 2; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            for (int k = 0; k <= n; k++) {
                ll cur = dp[i - 1][j][k + 1] + 2ll * (mod - dp[i - 1][j][k]);
                cur += dp[i - 1][j - 1][k];
                dp[i][j][k] = 1ll * cur * j * k % mod;
            }
        }
        int ans = 0;
        for (int j = 0; j <= n; j++) ans = (ans + dp[i][j][1]) % mod;
        printf("%d\n", ans);
    }
}