#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 999999999999999
#define endl "\n"
#define MOD 1000000007
 
const ll mod = 1000000007;
ll po(ll x,ll n,ll m){ll ans=1;while(n>0){if(n&1)
ans=(ans*x)%m;x=(x*x)%m;n/=2;}return ans;}


#define N 400
vector<ll> fac(N+1,0);
vector<ll> ifac(N+1,0);

ll nCr(ll n,ll r,ll m){
   

   if(n<=0) return 0;
   if(r>n) return 0;
   if(r<0) return 0;

   ll t = fac[n];
   t = (t*ifac[r])%m;
   t = (t*ifac[n-r])%m;
   return t;
}

void f(ll n,ll m){

fac[0] = fac[1] = 1;
ifac[0] = ifac[1] = 1;

for(int i=2;i<=n;i++){
  fac[i] = ((fac[i-1])*i)%m;
  ifac[i] = po(fac[i],m-2,m);
}

}

void func(){

ll n,m; cin>>n>>m;
f(n,m);

vector< vector<ll> > ans(n+1,vector<ll> (n+1,0));

for(int i=1;i<=n;i++){
  ans[i][0] = po(2,i-1,m);
  for(int j=1;j<=(i+1)/2-1;j++){
      for(int k=2;k<i;k++){
          ll l = k-1;
          ll r = i-k;
          ll t = (ans[l][0]*ans[r][j-1])%m;
          ll comb = nCr((r-j+2)+l-1,l,m);
          t = (t*comb)%m;
          ans[i][j] = (ans[i][j] + t)%m;
      }
  }
}

ll fans = 0;
for(int i=0;i<=n/2;i++)
  fans = (fans+ans[n][i])%m;

cout<<fans<<endl;


}
 
 
int main(){
            ios_base::sync_with_stdio(false); 
            cin.tie(0);
            cout.tie(0);  
     
          #ifndef ONLINE_JUDGE
          freopen("input.txt", "r" , stdin);
          freopen("output1.txt", "w" , stdout);
          #endif

      ll t=1;
      //cin>>t;
      while(t--)
      func();
      
}