#include <bits/stdc++.h>

int mod; 

inline void add(int &x, const int &y)
{
	if (x += y, x >= mod)
		x -= mod; 
}

const int MaxN = 1e4 + 5; 

int n, res; 
int f[MaxN]; 

int main()
{
	std::cin >> n >> mod; 
	if (n == 1)
		return puts("1"), 0; 
	else if (n == 2)
		return puts("3"), 0; 

	f[0] = 1; 
	for (int i = 2; i <= n; ++i)
	{
		int c = i <= (n >> 1) + 1 ? i - 1 : n - i + 2; 
		for (int j = c; j <= n; ++j)
			add(f[j], f[j - c]); 
	}
	for (int i = 0; i < n; ++i)
		add(res, 1LL * (n - i) * f[i] % mod); 

	std::cout << res << '\n'; 

	return 0; 
}
