ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Ural Regional School Programming Contest 2009

About     Problems     Submit solution     Judge status     Standings
Contest is over

D. Sold Out!

Time limit: 0.5 second
Memory limit: 64 MB
Every fall, all movies are shown to a full house at one of the most popular cinema theatres in Yekaterinburg because students like to spend their time sitting in a cosy chair and watching a movie instead of attending lectures and seminars. Unfortunately, the distance between the rows of seats in the cinema hall is small, and people constantly stumble over other people's feet as they get to their seats before the film exhibition. Entering the hall, a visitor chooses from which end of the row (left or right) he will make his way to his seat. He chooses it in such a way that the number of people over whose feet he will stumble will be minimal. If these numbers are equal for the left and right ends, the visitor chooses the end of the row which is closer to his seat.
Student of the Department of Philosophy Vasya is an enthusiastic movie-goer and an equally enthusiastic hater of mathematics. He was the first to buy a ticket to the first exhibition of a new movie. When Vasya entered the hall and sat down in his seat, he saw that other seats in the row were still unoccupied. Vasya knew that by the time the exhibition started the hall would be full. Therefore, quite a number of other visitors would stumble over his feet while getting to their seats. Despite his hatred for mathematics, Vasya was able to instantly estimate the maximal number of people that would stumble over his feet before the exhibition. Can you do the same?

Input

The only input line contains the total number of seats n in the row where Vasya is sitting and the number of his seat k (1 ≤ kn ≤ 50; n is even). These integers are separated with a space. The seats in the row are numbered starting with one.

Output

Output the maximal number of people who would stumble over Vasya's feet.

Sample

inputoutput
4 1
1
Problem Author: Denis Dublennykh (prepared by Oleg Dolgorukov)
Problem Source: Ural Regional School Programming Contest 2009
To submit the solution for this problem go to the Problem set: 1725. Sold Out!