description: This version of the problem differs from the next one only in the constraint on n.
  
  Note that the memory limit in this problem is lower than in others.
  
  You have a vertical strip with n cells, numbered consecutively from 1 to n from top to bottom.
  
  You also have a token that is initially placed in cell n. You will move the token up until it arrives at cell 1.
  
  Let the token be in cell x > 1 at some moment. One shift of the token can have either of the following kinds: 
  
    * Subtraction: you choose an integer y between 1 and x-1, inclusive, and move the token from cell x to cell x - y. 
    * Floored division: you choose an integer z between 2 and x, inclusive, and move the token from cell x to cell ⌊ x/z ⌋ (x divided by z rounded down). 
  
  
  
  Find the number of ways to move the token from cell n to cell 1 using one or more shifts, and print it modulo m. Note that if there are several ways to move the token from one cell to another in one shift, all these ways are considered distinct (check example explanation for a better understanding).
  
  Input
  
  The only line contains two integers n and m (2 ≤ n ≤ 2 ⋅ 10^5; 10^8 < m < 10^9; m is a prime number) — the length of the strip and the modulo.
  
  Output
  
  Print the number of ways to move the token from cell n to cell 1, modulo m.
  
  Examples
  
  Input
  
  
  3 998244353
  
  
  Output
  
  
  5
  
  
  Input
  
  
  5 998244353
  
  
  Output
  
  
  25
  
  
  Input
  
  
  42 998244353
  
  
  Output
  
  
  793019428
  
  Note
  
  In the first test, there are three ways to move the token from cell 3 to cell 1 in one shift: using subtraction of y = 2, or using division by z = 2 or z = 3.
  
  There are also two ways to move the token from cell 3 to cell 1 via cell 2: first subtract y = 1, and then either subtract y = 1 again or divide by z = 2.
  
  Therefore, there are five ways in total.
solution: // "static void main" must be defined in a public class.
  
  //System.out.println();
  // System.out.print();
  
  import java.util.*;
  import java.io.*;
  public class Main {
      
      
      static boolean isPrime(int n)
      {
          // Corner cases
          if (n <= 1) return false;
          if (n <= 3) return true;
           
          // This is checked so that we can skip
          // middle five numbers in below loop
          if (n % 2 == 0 || n % 3 == 0) return false;
           
          for (int i = 5; i * i <= n; i = i + 6)
              if (n % i == 0 || n % (i + 2) == 0)
              return false;
           
          return true;
      }
       
      // Function to return the smallest
      // prime number greater than N
      static int nextPrime(int N)
      {
       
          // Base case
          if (N <= 1)
              return 2;
       
          int prime = N;
          boolean found = false;
       
          // Loop continuously until isPrime returns
          // true for a number greater than n
          while (!found)
          {
              prime++;
       
              if (isPrime(prime))
                  found = true;
          }
       
          return prime;
      }
      
      
      public static int findXorSum(int arr[], int n)
      {
          // variable to store
          // the final sum
          long sum = 0;
       
          // multiplier
          long mul = 1;
       
          for (int i = 0; i < 30; i++)
          {
       
              // variable to store number of
              // sub-arrays with odd number of elements
              // with ith bits starting from the first
              // element to the end of the array
              long c_odd = 0;
       
              // variable to check the status
              // of the odd-even count while
              // calculating c_odd
              boolean odd = false;
       
              // loop to calculate initial
              // value of c_odd
              for (int j = 0; j < n; j++)
              {
                  if ((arr[j] & (1 << i)) > 0)
                      odd = (!odd);
                  if (odd)
                      c_odd++;
              }
       
              // loop to iterate through
              // all the elements of the
              // array and update sum
              for (int j = 0; j < n; j++)
              {
                  sum += (mul%1000000007 * c_odd%1000000007)%1000000007;
       
                  if ((arr[j] & (1 << i)) > 0)
                      c_odd = (n - j - c_odd);
              }
       
              // updating the multiplier
              mul = (mul%1000000007 * 2)%1000000007;
          }
       
          // returning the sum
          return (int)sum;
      }
      
      
      public static long fact(long n)
      {
          return (n == 1 || n == 0) ? 1 : n * fact(n - 1);
      }
      
      public static long nCr(long n, long r){
          return fact(n) / (fact(r) * fact(n - r));
      }
      
      public static long nPr(long n, long r){
          return fact(n) / fact(n - r);
      }
      
      public static long gcd(long a , long b){
          if(b==0){
              return a;
          }
          return gcd(b,a%b);
      }
      
      public static long lcm(long a, long b){return (a*b)/gcd(a,b);}
      
      public static long fPow(long x, long y, long p){
          long res = 1; // Initialize result
  
          x = x % p; // Update x if it is more than or
          // equal to p
  
          if (x == 0)
            return 0; // In case x is divisible by p;
  
          while (y > 0)
          {
  
            // If y is odd, multiply x with result
            if ((y & 1) != 0)
              res = (res * x) % p;
  
            // y must be even now
            y = y >> 1; // y = y/2
            x = (x * x) % p;
          }
          return res;
      }
      
      public static int binS(int[] sortedArray, int key, int low, int high) {
      int index = Integer.MAX_VALUE;
      
      while (low <= high) {
          int mid = low  + ((high - low) / 2);
          if (sortedArray[mid] < key) {
              low = mid + 1;
          } else if (sortedArray[mid] >= key) {
              high = mid - 1;
          }
          // else if (sortedArray[mid] == key) {
          //     low = mid;
          //     break;
          // }
      }
      return low;
  }
      
      public static int binS1(int[] sortedArray, int key, int low, int high) {
      int index = Integer.MAX_VALUE;
      
      while (low <= high) {
          int mid = low  + ((high - low) / 2);
          if (sortedArray[mid] <= key) {
              low = mid + 1;
          } else if (sortedArray[mid] > key) {
              high = mid - 1;
          }
          // else if (sortedArray[mid] == key) {
          //     low = mid;
          //     break;
          // }
      }
      return high;
  }
   
      public static class Pair{
          int x;
          int y;
          Pair(int x, int y){
              this.x=x;
              this.y=y;
          }
      }
      public static void main(String[] args) throws IOException {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          // int t = Integer.parseInt(br.readLine());
          // for(int q=0;q<t;q++){
              // int n = Integer.parseInt(br.readLine());
              String s1[] = br.readLine().split(" ");
              int n = Integer.parseInt(s1[0]);
              // String s = s1[0];
              int k = Integer.parseInt(s1[1]);
              // int c = Integer.parseInt(s[2]);
              // String s1[] = br.readLine().split(" ");
              // int a[] = new int[n];
              // for(int i=0;i<n;i++){
              //     a[i] = Integer.parseInt(s1[i]);
              // }
              long dp[] = new long[n+1];
              dp[1]=1;
              dp[2]=2;
              long sum=3;
              for(int i=3;i<=n;i++){
                  dp[i]=sum%k;
                  for(int j=2;;j++){
                      if(i/j<=1){
                          // System.out.println("*"+i+" "+j);
                          dp[i]+=((long)i-(long)j+1)%k;
                          break;
                      }
                      else{
                          // System.out.println(i+" "+j);
                          int tmp1 = i/(i/j);
                          dp[i]+=((long)(dp[i/j])*(long)(tmp1-j+1))%k;
                          j += tmp1-j;
                      }
                  }
                  sum+=(dp[i])%k;
              }
              System.out.println(dp[n]%k);
          }
      }
  // }
  //1116776899 3