#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, t1, t2, t3, t4, n, k, a1, a2, low, mid, high;
  scanf("%d %d", &n, &k);
  if (k > 0 && k < n) {
    a1 = 1;
    t1 = n % 3;
    t2 = n + (3 - t1);
    t2 /= 3;
    if (k >= t2) {
      a2 = n - k;
    } else {
      a2 = 2 * k;
    }
  } else {
    a1 = a2 = 0;
  }
  printf("%d %d\n", a1, a2);
  return 0;
}
