#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=1e5+50;
int P; 
int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
int gcd(int a,int b){ return !b?a:gcd(b,a%b); }
 
int n,m,a[N],f[N],ans;
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
#endif
	read(n),read(P),m=n/2; 
	rep(i,2,m+1)a[i]=i-1;
	rep(i,m+2,n)a[i]=n-i+2;
	f[0]=1;
	rep(i,2,n)rep(j,a[i],n)f[j]=add(f[j],f[j-a[i]]); 
	rep(j,0,n)ans=add(ans,mul(n-j,f[j])); 
	printf("%d\n",ans); 
	return 0;
}
