#include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
  cin >> n >> k;
  if (k == 0 || k == n) {
    cout << "0 0";
    return 0;
  }
  cout << 1 << " ";
  if (k >= n / 2) {
    cout << n - k;
  } else {
    cout << min(k * 2, n - k);
  }
}
