#include <bits/stdc++.h>
double EPS = 1e-9;
long long INFF = 1000000000000000005LL;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k;
  cin >> n >> k;
  cout << (k == n || k == 0 ? 0 : 1) << ' '
       << ((3 * k <= n) ? 2 * k : 2 * k - (3 * k - n)) << '\n';
  return 0;
}
