Another possible choice is to use artificial neural networks to determine m. In this case, the task is used as the training set for an MLP, that has K outputs.