QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 100

#7825. Fundamentals of Programming

統計

While studying the topic of "binary representation of numbers," an informatics teacher came up with the following problem. You are given two numbers $N$ and $M$. Find the index of the first occurrence (from the left) of the binary code of $M$ in the binary code of $N$, assuming that both binary codes do not contain leading zeros. Can you handle this task?

Input

A single line containing two non-negative integers $N$ and $M$ separated by a space, where $0 \leqslant M \leqslant N \leqslant 10^{19}$.

Output

A single integer — the index of the first occurrence of the binary code of $M$ in the binary code of $N$. The index of the leftmost position in $N$ is considered to be $0$. If there is no occurrence, output $-1$.

Examples

Input 1

6 2

Output 1

1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.