#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, m, sum = 0;
  cin >> n >> m;
  vector<long long int> dp(n + 1);
  sum = 1;
  dp[1] = 1;
  for (i = 2; i <= n; i++) {
    dp[i] = sum;
    for (j = 1; j * j <= i; j++) {
      dp[i] += (dp[j] * (i / j - i / (j + 1))) % m;
      if (j != i / j && j > 1) dp[i] += dp[i / j];
      dp[i] %= m;
    }
    sum += dp[i];
    sum %= m;
  }
  cout << dp[n];
}
