#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 1;
const int mod = 1e9 + 7;
template <typename X, typename Y>
ostream& operator<<(ostream& os, pair<X, Y>& p) {
  return cout << p.first << ' ' << p.second << '\n';
}
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> dp(n + 1);
  dp[1] = 1;
  long long sum = 1;
  for (long long i = 2; i <= n; i++) {
    long long temp = 0;
    long long last = 1;
    dp[i] = sum;
    for (long long j = 2; (j * j) < i; j++) {
      temp = temp + dp[i / j];
      temp %= m;
      last = j;
    }
    for (long long c = 1; (c * c) <= i; c++) {
      long long v = (i / c - max(last + 1, (i / (c + 1) + 1))) + 1;
      temp = temp + v * dp[c];
      temp %= m;
    }
    dp[i] += (temp);
    dp[i] %= m;
    sum = sum + dp[i];
    sum %= m;
  }
  cout << dp[n] << '\n';
}
signed main() { solve(); }
