#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long n, k;
  cin >> n >> k;
  long long mn, mx;
  if (k == 0) {
    mn = 0;
  } else if (k == n) {
    mn = 0;
  } else {
    mn = 1;
  }
  if (k == 0 || k == n) {
    mx = 0;
  } else {
    mx = min(2 * k, n - k);
  }
  cout << mn << " " << mx << endl;
  return 0;
}
