#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 0x7fffffff;
int n, m;
long long dp[100005 << 1];
void solve() {
  cin >> n >> m;
  long long pre = 1;
  dp[1] = 1;
  for (int i = 2; i <= n; i++) {
    dp[i] = (dp[i] + pre) % m;
    long long x = dp[i];
    long long cnt = 0;
    for (int l = 1, r = 0; l <= i; l = r + 1) {
      r = i / (i / l);
      cnt = (cnt % m + (r - l + 1) * dp[i / l] % m) % m;
    }
    dp[i] = (dp[i] + cnt - x) % m;
    pre = (pre + dp[i]) % m;
  }
  cout << dp[n] << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
