#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    int minn = n == k || k == 0 ? 0 : 1;
    int maxn;
    if (k >= n / 3 + 1) {
      maxn = n - k;
    } else {
      maxn = 2 * k;
    }
    printf("%d %d\n", minn, maxn);
  }
  return 0;
}
