#include <bits/stdc++.h>
using namespace std;
int n, k;
int findMax() {
  if (k <= n / 3) {
    return (2 * k);
  } else {
    return (n - k);
  }
}
int findMin() {
  if (k == 0)
    return 0;
  else
    return 1;
}
void solve() {
  cin >> n >> k;
  if (n == k) {
    cout << "0 0\n";
    return;
  }
  int res_min = findMin();
  int res_max = findMax();
  cout << res_min << " " << res_max << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}
