import streams, sequtils, strutils, algorithm, math, future, sets, tables, hashes proc `ceilDiv`*[T](x, y: T): T = x div y + ord(x mod y != 0) proc `//=`*(x: var SomeInteger; y: SomeInteger) = x = x div y proc `%=`*(x: var SomeInteger; y: SomeInteger) = x = x mod y var L = stdin.readLine.split.map(parseInt) A = L[0] B = L[1] N = 0 Np = 0 Np = B N = A * Np + B if Np == 0: echo 1 elif N == 0: echo 2 else: echo -1