#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long, long);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, long *, long *);
int main() {
  long n, m, g, c;
  scanf("%ld %ld", &n, &m);
  g = n * 2 - m / 2;
  c = m / 2 - n;
  if ((g + c == n) && (g * 2 + c * 4 == m) && (g >= 0) && (c >= 0))
    printf("%ld %ld\n", g, c);
  else
    puts("-1");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
sub    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    11ef <main+0xbf>
mov    -0x20(%rbp),%rax
shl    $0x1,%rax
mov    -0x28(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
cmp    -0x18(%rbp),%rax
jne    11ef <main+0xbf>
cmpq   $0x0,-0x20(%rbp)
jl     11ef <main+0xbf>
cmpq   $0x0,-0x28(%rbp)
jl     11ef <main+0xbf>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
jmp    11fb <main+0xcb>
lea    0xe1b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x10(%rsp),%rax
lea    (%rax,%rax,1),%rsi
cmp    %rsi,%rsi
jne    1199 <main+0x69>
mov    0x8(%rsp),%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
add    %rcx,%rdx
sar    %rdx
sub    %rdx,%rsi
sub    %rax,%rdx
lea    0x0(,%rdx,4),%rax
lea    (%rax,%rsi,2),%rax
cmp    %rcx,%rax
jne    1199 <main+0x69>
test   %rsi,%rsi
js     1199 <main+0x69>
test   %rdx,%rdx
js     1199 <main+0x69>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
jmp    11a5 <main+0x75>
lea    0xe71(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%ld %ld\00"
@.str.1 = [9 x i8] c"%ld %ld\0A\00"
@.str.2 = [3 x i8] c"-1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %2, i64* %3)
%7 = load i64, i64* %2
%8 = mul nsw i64 %7, 2
%9 = load i64, i64* %3
%10 = sdiv i64 %9, 2
%11 = sub nsw i64 %8, %10
store i64 %11, i64* %4
%12 = load i64, i64* %3
%13 = sdiv i64 %12, 2
%14 = load i64, i64* %2
%15 = sub nsw i64 %13, %14
store i64 %15, i64* %5
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = add nsw i64 %16, %17
%19 = load i64, i64* %2
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %39
21: ; preds = %0
%22 = load i64, i64* %4
%23 = mul nsw i64 %22, 2
%24 = load i64, i64* %5
%25 = mul nsw i64 %24, 4
%26 = add nsw i64 %23, %25
%27 = load i64, i64* %3
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %39
29: ; preds = %21
%30 = load i64, i64* %4
%31 = icmp sge i64 %30, 0
br i1 %31, label %32, label %39
32: ; preds = %29
%33 = load i64, i64* %5
%34 = icmp sge i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load i64, i64* %4
%37 = load i64, i64* %5
%38 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %36, i64 %37)
br label %41
39: ; preds = %32, %29, %21, %0
%40 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39, %35
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%ld %ld\00"
@.str.1 = [9 x i8] c"%ld %ld\0A\00"
@.str.2 = [3 x i8] c"-1\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%6 = load i64, i64* %1
%7 = shl nsw i64 %6, 1
%8 = load i64, i64* %2
%9 = sdiv i64 %8, 2
%10 = sub nsw i64 %7, %9
%11 = sub nsw i64 %9, %6
%12 = add nsw i64 %10, %11
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %25
14: ; preds = %0
%15 = shl nsw i64 %10, 1
%16 = shl nsw i64 %11, 2
%17 = add nsw i64 %15, %16
%18 = icmp eq i64 %17, %8
%19 = icmp sgt i64 %10, -1
%20 = select i1 %18, i1 %19, i1 false
%21 = icmp sgt i64 %11, -1
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %23, label %25
23: ; preds = %14
%24 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %10, i64 %11)
br label %27
25: ; preds = %14, %0
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
ret i32 0
}