Daya,Doors and breaking
Tag(s):

## Very-Easy

Problem
Editorial
Analytics

Daya from CID wants to break n consecutive doors.He will break only 2 doors or 1 door in a single kick.

ACP's condition is that number of kicks must be a multiple of k .

Find minimal number of kicks so Daya can break all gates that satisfies ACP's condition?

print -1 if not possible.

INPUT

• First line of input contains two integer n and k .

OUTPUT

• Output a single integer denoting the answer if it is not possible to find an answer satisfying the conditions then print -1 instead.

CONSTRAINTS

• 0 < n ≤ 10000
• 1 < m ≤ 10
SAMPLE INPUT
10 2
SAMPLE OUTPUT
6
Explanation

Daya's door optimal breaking sequence can be 2,2,2,2,1,1

So total kicks ( 6 ) is a multiple of 2.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

MNIT-Codes Episode-01

OTHER PROBLEMS OF THIS CHALLENGE
• Math > Polygon
• Math > Number Theory
• Basic Programming > Implementation