Maxim Buys an Apartment

题意翻译

Maxim想在大都会的莱恩大道上买一座新的公寓。这幢楼房共有 n 座公寓,从 1 到 n 编号排列在一个数列中。两座相邻公寓的编号相差为 1。有一些公寓已经被售出了,另外的一些是待售的。 Maxim时常拜访他的邻居,因此如果有一座待售公寓,其相邻公寓中至少有一座是已售出的,那么这座公寓很适合Maxim。Maxim已经知道了有 k 座公寓已被售出,但是他还不知道这些已售出公寓的编号是多少。 计算出适合Maxim的公寓数可能的最小值及最大值。 输入格式: 输入数据只包括两个整数 n,k(1 <= n <= 10^9,0 <= k <= n)。 输出格式: 输出可能的最小值及最大值。 说明: 在样例中,如果编号为 1,2,3 的公寓被售出了,那么只有编号为 4 的公寓适合Maxim。如果编号为 1,3,5 的公寓被售出了,那么编号为 2,4,6 的公寓都是适合Maxim的。 Translated by @radish布団

题目描述

Maxim wants to buy an apartment in a new house at Line Avenue of Metropolis. The house has $ n $ apartments that are numbered from $ 1 $ to $ n $ and are arranged in a row. Two apartments are adjacent if their indices differ by $ 1 $ . Some of the apartments can already be inhabited, others are available for sale. Maxim often visits his neighbors, so apartment is good for him if it is available for sale and there is at least one already inhabited apartment adjacent to it. Maxim knows that there are exactly $ k $ already inhabited apartments, but he doesn't know their indices yet. Find out what could be the minimum possible and the maximum possible number of apartments that are good for Maxim.

输入输出格式

输入格式


The only line of the input contains two integers: $ n $ and $ k $ ( $ 1<=n<=10^{9} $ , $ 0<=k<=n $ ).

输出格式


Print the minimum possible and the maximum possible number of apartments good for Maxim.

输入输出样例

输入样例 #1

6 3

输出样例 #1

1 3

说明

In the sample test, the number of good apartments could be minimum possible if, for example, apartments with indices $ 1 $ , $ 2 $ and $ 3 $ were inhabited. In this case only apartment $ 4 $ is good. The maximum possible number could be, for example, if apartments with indices $ 1 $ , $ 3 $ and $ 5 $ were inhabited. In this case all other apartments: $ 2 $ , $ 4 $ and $ 6 $ are good.