Sabzeh with Lentils


Parsa's Grandmother has prepared a row of nn planting positions, numbered from 11 to nn. She wants to plant exactly kk lentil seeds in these positions.

At most one seed can be planted in each position.

If two consecutive positions both contain a seed, that creates one adjacent occupied pair. Grandmother wants to place the kk seeds so that the number of adjacent occupied pairs is as small as possible.

Compute this minimum possible number.

Input

The input contains two integers, nn the number of positions and kk, the number of lentil seeds.

Output

Print a single integer: the minimum possible number of adjacent occupied pairs.

Constraints

  • 2n1002 \le n \le 100
  • 1kn1 \le k \le n

Example 1

Input 1
5 2
Output 1
0

Example 2

Input 2
5 4
Output 2
2

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.