#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    
    int numOfChicken, numOfRabbit, m, n;
    
    scanf("%d %d", &n, &m);
    
    numOfChicken = (4*n - m) / 2 ;
    numOfRabbit = n - numOfChicken;
    
    if( numOfChicken < 0 || numOfRabbit < 0 || m % 2 == 1)
        printf("error");
    else
        printf("%d %d", numOfChicken, numOfRabbit);
    
    return 0;
}