#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long oo = 1e18;
const long double eps = 1e-9;
const string yes = "YES";
const string no = "NO";
const long double PI = acos(-1.0);
void io(long long x) {
  if (!x) {
    freopen(
        "1561d1"
        ".inp",
        "r", stdin);
    return;
  }
  if (x == 1) {
    freopen(
        "1561d1"
        ".inp",
        "r", stdin);
    freopen(
        "1561d1"
        ".out",
        "w", stdout);
    return;
  }
  freopen(
      "1561d1"
      ".out",
      "w", stdout);
}
long long n, m;
const long long N = 2e5 + 5;
long long dp[N];
long long dp1[N];
void add(long long &a, long long b) { ((a += b) %= m); }
void solve() {
  cin >> n >> m;
  dp[n] = dp1[n] = 1;
  for (long long i = n - 1; i; i--) {
    add(dp[i], dp1[i + 1]);
    for (long long j = 2 * i; j <= n; j += i) {
      long long maxx = min(n + 1, (j / i) + j);
      add(dp[i], (dp1[j] - dp1[maxx] + m) % m);
    }
    dp1[i] = (dp1[i + 1] + dp[i]) % m;
  }
  cout << dp[1] << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long test_case = 1;
  for (long long tt = 1; tt <= test_case; tt++) {
    solve();
  }
  return 0;
}
