#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int dp[N];
int n, m;
int main() {
  dp[1] = 1;
  int sum = 1;
  cin >> n >> m;
  for (int i = 2; i <= n; i++) {
    dp[i] = (dp[i] + sum) % m;
    for (int x = 2, gx; x <= i; x = gx + 1) {
      gx = i / x ? min(i / (i / x), i) : i;
      dp[i] = (dp[i] + (gx - x + 1) * 1ll * dp[i / x] % m) % m;
    }
    sum = (sum + dp[i]) % m;
  }
  cout << dp[n] << '\n';
}
