#C1382. Coin Splitting
Coin Splitting
Coin Splitting
You are given two integers \(n\) and \(m\). Initially, you have \(n\) coins, each of value 1. You can perform a splitting operation on any coin, which increases the total number of coins by 1. In one operation you are allowed to split one coin (i.e. you cannot combine coins in a single split).
Your goal is to obtain exactly \(m\) coins by performing a series of splitting operations. Note that if \(m < n\), it is impossible to reduce the number of coins, so the answer in that case is \(-1\).
It can be shown that if \(m \ge n\), the minimum number of splits required is \(m - n\). For example, if \(n = 4\) and \(m = 10\), then you need \(10 - 4 = 6\) splits.
inputFormat
The input consists of a single line containing two space-separated integers \(n\) and \(m\) (\(1 \le n, m \le 10^9\)).
outputFormat
Output a single integer which is the minimum number of splits required to obtain exactly \(m\) coins. If it is not possible, output \(-1\).
## sample4 10
6