1023_B. Pair of Toys_28520
Tanechka is shopping in the toy shop. There are exactly n toys in the shop for sale, the cost of the i-th toy is i burles. She wants to choose two toys in such a way that their total cost is k burles. How many ways to do that does she have?

Each toy appears in the shop exactly once. Pairs (a, b) and (b, a) are considered equal. Pairs (a, b), where a=b, are not allowed.

Input

The first line of the input contains two integers n, k (1 ≤ n, k ≤ 10^{14}) — the number of toys and the expected total cost of the pair of toys.

Output

Print the number of ways to choose the pair of toys satisfying the condition above. Print 0, if Tanechka can choose no pair of toys in such a way that their total cost is k burles.

Examples

Input

8 5


Output

2


Input

8 15


Output

1


Input

7 20


Output

0


Input

1000000000000 1000000000001


Output

500000000000

Note

In the first example Tanechka can choose the pair of toys (1, 4) or the pair of toys (2, 3).

In the second example Tanechka can choose only the pair of toys (7, 8).

In the third example choosing any pair of toys will lead to the total cost less than 20. So the answer is 0.

In the fourth example she can choose the following pairs: (1, 1000000000000), (2, 999999999999), (3, 999999999998), ..., (500000000000, 500000000001). The number of such pairs is exactly 500000000000.
n,k = [int(x) for x in input().split()]
if k>n:
    if k>=2*n:
        print(0)
    else:
        print((2*n-k+1)//2)
else:
    if k%2==0:
        k-=1
    print(k//2)
8 15
 1000000000000 1000000000001
 7 20
 8 5
 99999999999999 100000000000000
 100000000000000 100000000000000
 4 7
 50000000000000 99999999999999
 3 1
 1 100000000000000
 4 4
 49999999999996 99999999999999
 49999999999997 99999999999999
 3 4
 3 2
 6 8
 50000000000003 99999999999999
 1 5
 2 4
 5 8
 1010101010 1010101010
 1 2
 41 66
 100000000000000 5
 100000000000000 99999999999999
 99999999999999 65536
 100000000000000 11
 50000000000000 100000000000000
 3294967296 5
 4 5
 1 6
 3 6
 7 10
 3 3
 50000000000001 99999999999999
 1 1
 50000000000002 99999999999999
 13324 13736
 4 2
 4827 5436
 1 123456789
 99999999999998 100000000000000
 3 5
 100000000000000 2
 100000000000 100000000001
 1 8
 38 74
 2 5
 2 8
 2 6
 99999999999977 100000000000000
 100000000000000 4
 100000000000000 99999999999998
 100000000000000 1023
 49999999999998 100000000000000
 100000000000000 1
 4 6
 2 2
 4 8
 100000000000 130000000000
 50000000000001 100000000000000
 4 1
 4 3
 123456789 1
 1 7
 8 14
 2 3
 100000000000 10000000000
 998244353 19260817
 49999999999998 99999999999999
 7 14
 8 16
 100000000000000 6
 1 4
 49999999999997 100000000000000
 99999999999999 99999999999998
 100000000000 130000000001
 50000000000003 100000000000000
 49999999999999 99999999999999
 7 8
 99999999999996 100000000000000
 50000000000002 100000000000000
 2 7
 44999999999177 100000000000000
 49999999999996 100000000000000
 69999999999177 100000000000000
 99999999999997 100000000000000
 2 1
 100000000000000 3
 3 8
 3 7
 99999999999999 99999999999997
 49999999999999 100000000000000
 59999999999177 100000000000000
 1 3
 100000000000000 100
 100000000000 100000000000
 99999999999999 99999999999999
 99999999999999 100000000001000
 100000000010000 100000000000000
 4 11
 50000000000000 59204469252435
 6 3
 1010101010 1011101010
 41 63
 100000000010000 5
 156463135268026 65536
 110000000000000 11
 72209373991004 100000000000000
 3294967296 10
 68861863843081 99999999999999
 13324 15178
 100000000000 100000000011
 99999999999977 100000000000100
 100000000000001 99999999999998
 7 7
 100000000000 110546196252
 100000000000 10000001000
 825954239 19260817
 99999999999999 164374093490300
 100000010000 130000000001
 49999999999999 14752772551252
 92122820665616 100000000000000
 92303240844096 100000000000000
 59999999999177 100000000100000
 100010000000000 100
 100000000000 100000100000
 99999999999999 103246683590518
 1000000010000 1000000000001
 105925489085800 100000000001000
 50000000000000 59257435820612
 93803127109369 150878756750858
 1 110000000000000
 45765460895346 99999999999999
 2220334390216 99999999999999
 8 4
 50000000000003 150878756750858
 1 14
 5 2
 5 16
 100000100000000 99999999999999
 4 12
 1 10
 3 9
 7 2
 7 5
 981098184001 99999999999999
 7 1
 2108 5436
 1 61960338
 12283935172049 100000000000000
 6 5
 100000000000010 1
 38 102
 2 10
 0 1
 2 12
 100000000001000 4
 100001000000000 11
 12550978948660 100000000000000
 110000000000000 4
 6 2
 31121108554531 100000000000000
 6 10
 182480173 1
 8 27
 14360987829795 99999999999999
 3 14
 6 16
 100000000000100 6
 0 2
 44604552259816 100000000000000
 50000000000003 100000000001000
 8 8
 125933287682784 100000000000000
 2 13
 44999999999177 100001000000000
 33733668057826 100000000000000
 10042931378507 100000000000000
 110000000000000 3
 6 4
 27808842428411 99999999999997
 49999999999999 100010000000000
 9 20
 5 5
 101000000010000 100000000000000
 9 5
 45765460895346 152657771153606
 2220334390216 194335198485292
 8 3
 1 13
 5 3
 9 16

1
 500000000000
 0
 2
 49999999999999
 49999999999999
 1
 1
 0
 0
 1
 0
 0
 1
 0
 2
 4
 0
 0
 1
 505050504
 0
 8
 2
 49999999999999
 32767
 5
 0
 2
 2
 0
 0
 2
 1
 2
 0
 3
 6456
 0
 2109
 0
 49999999999998
 1
 0
 50000000000
 0
 1
 0
 0
 0
 49999999999977
 1
 49999999999998
 511
 0
 0
 1
 0
 0
 35000000000
 1
 0
 1
 0
 0
 1
 1
 4999999999
 9630408
 0
 0
 0
 2
 0
 0
 49999999999998
 35000000000
 3
 0
 3
 49999999999996
 2
 0
 0
 0
 19999999999177
 49999999999997
 0
 1
 0
 0
 49999999999998
 0
 9999999999177
 0
 49
 49999999999
 49999999999999
 49999999999499
 49999999999999
 0
 20397765373783
 1
 504550505
 10
 2
 32767
 5
 22209373991004
 4
 18861863843082
 5735
 49999999995
 49999999999927
 49999999999998
 3
 44726901874
 5000000499
 9630408
 17812953254849
 35000010000
 7376386275625
 42122820665616
 42303240844096
 9999999949177
 49
 49999950000
 48376658204740
 500000000000
 50000000000499
 20371282089694
 18363748733940
 0
 0
 0
 1
 0
 0
 0
 0
 49999999999999
 0
 0
 0
 0
 2
 0
 0
 0
 0
 0
 2
 0
 0
 0
 0
 0
 1
 5
 0
 1
 0
 0
 1
 0
 0
 0
 0
 0
 2
 0
 0
 0
 3
 49999999999999
 0
 0
 0
 0
 1
 1
 0
 0
 0
 2
 49999999999999
 2
 0
 0
 1
 0
 1
 1
