A minimum binary heap, often simply referred to as a "min-heap," is a specialized type of binary tree-based data structure used in computer science. It is a binary tree that has two main properties:
Min-heaps are often used to implement priority queues, which are data structures that maintain a collection of elements with associated priorities. By keeping the minimum element at the root, min-heaps can quickly retrieve and remove the element with the highest priority (lowest value) in logarithmic time. However, removing any other element from a min-heap may need linear time.
Hank recently learned min-heaps. He wonders how many nodes can keep the $$$k$$$-th smallest element in a min-heap of $$$n$$$-nodes. Please write a program to help him.
The input contains two space-separated positive integers $$$n$$$ and $$$k$$$. $$$1\le k\le n\le 10^{18}$$$.
Output the number of nodes that can keep the $$$k$$$-th smallest element in a min-heap of $$$n$$$ nodes.
100 1
1
12 3
6
Please assume that all elements are distinct.
| Название |
|---|


