#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647;
const long long INF = 9223372036854775807;
auto min = [](int a, int b) { return a > b ? b : a; };
auto max = [](int a, int b) { return a > b ? a : b; };
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int pro = n / 3, les = n % 3;
  int maxn, minn;
  if (k == 0) {
    maxn = minn = 0;
  } else if (n == 2 && k == 2) {
    maxn = minn = 0;
  } else if (k <= pro) {
    maxn = k * 2;
    minn = 1;
  } else if (k == pro + 1) {
    maxn = pro * 2;
    if (les == 2)
      maxn++;
    else if (les == 0)
      maxn--;
    minn = k == n ? 0 : 1;
  } else {
    maxn = pro * 2;
    if (les == 1) pro++;
    if (les == 2) {
      maxn++;
      pro++;
    }
    maxn -= k - pro;
    minn = k == n ? 0 : 1;
  }
  printf("%d %d\n", minn, maxn);
  return 0;
}
