#MTHA0000002. Đếm bội trong đoạn đầu (Count Multiples in a Prefix)

Đếm bội trong đoạn đầu (Count Multiples in a Prefix)

Count Multiples in a Prefix

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers NN and KK, consider the integers from 11 to NN. An integer is a multiple of KK if it is divisible by KK. Count the multiples of KK in [1,N][1,N].

Input

One line contains two positive integers NN and KK.

Output

Print the number of integers XX satisfying 1≤X≤N1\le X\le N and K∣XK\mid X.

Subtasks

  • Subtask 1 (30 points):
    • 1≤N≤1061 \le N \le 10^6.
    • 1≤K≤10181 \le K \le 10^{18}.
  • Subtask 2 (70 points):
    • 1≤N≤10181 \le N \le 10^{18}.
    • 1≤K≤10181 \le K \le 10^{18}.

Examples

Example 1

Input

20 3

Output

6

Explanation

The multiples not exceeding 2020 are 3,6,9,12,15,183,6,9,12,15,18, so the answer is 66.

Example 2

Input

7 10

Output

0

Explanation

The smallest positive multiple of 1010 is 10>710>7, so there are no valid integers.

Example 3

Input

1000000000000000000 1000000000

Output

1000000000

Explanation

We have 1018÷109=10910^{18}\div 10^9=10^9, hence there are exactly 10910^9 multiples.