#include <bits/stdc++.h>
const int inf = INT_MAX;
using namespace std;
int n;
int main() {
  int m;
  scanf("%d %d\n", &n, &m);
  int mi = 0;
  if (m == n || m == 0)
    mi = 0;
  else
    mi = 1;
  int ma = 0;
  if (m == 0 || m == n) {
    cout << 0 << " " << 0;
    return 0;
  }
  if ((long long)m * 3ll <= (long long)n) {
    ma = m * 2;
  } else
    ma = n - m;
  cout << mi << " " << ma;
  return 0;
}
