Problem:
Score : 200 points

Problem Statement

Takahashi's house has only one socket.

Takahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.

One power strip with A sockets can extend one empty socket into A empty sockets.

Find the minimum number of power strips required.

Constraints

All values in input are integers.

2 \leq A \leq 20

1 \leq B \leq 20

Input

Input is given from Standard Input in the following format:

A B

Output

Print the minimum number of power strips required.

Sample Input 1

4 10

Sample Output 1

3

3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.

Sample Input 2

8 9

Sample Output 2

2

2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.

Sample Input 3

8 8

Sample Output 3

1

Solution in Java (OpenJDK 11.0.6) (judge verdict: Wrong Answer)

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//		int t = sc.nextInt();
//		StringBuilder finalAns = new StringBuilder();
//		int a1 = 2, b1 = 1;
//		while (true) {
//			if (b1 == 20) {
//				a1++;
//				b1 = a1;
//			} else {
//				b1++;
//			}
		int a = sc.nextInt(), b = sc.nextInt();
		double x = Math.floor(Math.log(b) / Math.log(a));
		double ans = Math.pow(a, x);
		x += Math.ceil((b - ans) / (a - 1));
		System.out.println((int) x);
//		if (a == 20 && b >= 20)
//			break;
//		}
		sc.close();
	}
}