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