A licensing system issues serial numbers 1, 2, 3, \dots A serial number is called K-flagged if its binary representation contains exactly K one-bits.
Given N and K, count how many K-flagged serial numbers exist in the range [1, N].
Input format
Line 1: two space-separated integers N K.
Output format
A single integer: the count of integers in [1, N] with exactly K one-bits.
Constraints
- 1 ≤ N ≤ 1,000,000,000,000,000,000
- 0 ≤ K ≤ 62