#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<i64> f(n + 1);
  i64 suf = 0;
  f[n] = 1;
  for (int i = n; i >= 1; i--) {
    f[i] = (f[i] + suf) % m;
    for (int l = 2, r; l <= i; l = r + 1) {
      r = i / (i / l);
      f[i / l] = (f[i / l] + (r - l + 1) * f[i]) % m;
    }
    suf = (suf + f[i]) % m;
  }
  cout << f[1] << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
  return 0;
}
