I can't remember the exact details, but you should use a deque in order to improve the DP to run in O(N*K). If this hint is doesn't help you enough, I'll think of the problem in a couple of days and post a more detailed solution.
hm.. I still don't get the idea how to solve it with a deque
Further helps needed 


. But some problems are not translated correctly. I hope one day, there will be an English version for this site. 

