Pizza
A group of M people has arrived at a pizzeria. After some discussion, they decide to order one large pizza with K different toppings. The pizza is circular and is divided into K equal slices, each featuring a unique topping. Initially, the pizza is served whole, without any cuts.
The group requests the waiter to cut the pizza into M equal slices, ensuring each person receives one piece. The goal is to maximize the number of people who receive a slice containing at least two different toppings.
Your task is to help the waiter determine the maximum number of people who can receive a slice with more than one topping when the pizza is cut in the most optimal manner.
Input
You are provided with two integers, K and M (1 ≤ K ≤ 100, 1 ≤ M ≤ 100), representing the number of toppings on the pizza and the number of people in the group, respectively.
Output
Output the maximum number of people who can receive a slice with more than one topping.