#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
using namespace std;

const int maxn = 5e3;
int n, k, mod, a[maxn + 5], f[maxn + 5];

int main() {
	scanf("%d %d", &n, &mod);
	k = (n - 1) / 2;
	rep(i, 1, k + 1) a[i]++;
	per(i, n, n - k + 1) a[i]--;
	rep(i, 1, n) a[i] += a[i - 1];
	f[0] = 1;
	rep(i, 1, n) {
		int x = a[i];
		rep(j, x, n - 1) f[j] = (f[j] + f[j - x]) % mod;
	}
	int s = 0;
	rep(i, 0, n - 1) s = (s + f[i]) % mod;
	printf("%d\n", s);
	return 0;
}