Create K.cpp

It is competely working. Working fine, returning proper answers. Dunno what the mistake is.