Moved K from being hard-coded to being the 4th program argument.