#include <bits/stdc++.h>
using namespace std;
const int N = 101005;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<long long> dp(n + 1, 0);
  dp[1] = 1;
  long long sum = 1;
  for (int i = 2; i <= n; i++) {
    dp[i] = (dp[i] + sum) % m;
    dp[i] += (i - i / 2) * dp[1];
    dp[i] %= m;
    int sqr = sqrt(i);
    for (int j = 2; j <= sqr; j++) {
      dp[i] += ((i / j - i / (j + 1)) * dp[j]) % m;
      dp[i] %= m;
      if (i / sqr > j) {
        dp[i] = (dp[i] + dp[i / j]) % m;
      }
    }
    sum = (sum + dp[i]) % m;
  }
  cout << dp[n] << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(30);
  solve();
  return 0;
}
