#include <cstdio>
#include <algorithm>

using std::max;
using std::min;

int b, s;

int main()
{
	scanf( "%d%d", &b, &s );
	
	int hi = 10000;
	int lo = 3;
	
	for( int i = 3; i < 5001; i++ ) {
		int x = i;
		int y = b/2 - x + 2;
		
		if( ( x - 2 ) * ( y - 2 ) == s ) {
			printf( "%d %d\n", max( x, y ), min( x, y ) );
			return 0;
		}
	}
}
