Pizza#892

Pizza

1 second
64 megabytes
Very easy

A group of people arrives at a pizzeria. After discussing, they decide to order a single large pizza with different toppings. The pizza is circular and divided into equal sectors, each with its own topping. The pizza is served whole, uncut.

The friends ask the waiter to cut the pizza into equal sectors, so that each person gets one slice. The goal is to maximize the number of people who receive a slice that contains at least two different toppings.

Help the waiter determine the largest possible number of people who can receive a slice with more than one topping, if the pizza is cut in the most optimal way.

Input

You are given two integers , (1 \leq K \leq 100, 1 \leq M \leq 100) — 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.

Examples

Example 1

Loading
Loading