This is a DP on Trees problem. Unless I'm mistaken, the question basically requires us to:
Divide the tree into a number of (different) connected subsets of nodes (or sub-trees) in the tree, with at least one of the sub-trees having exactly K nodes. Then, output the number of edges connecting the different sub-trees.
Any hints? The editorial is unavailable unfortunately. :/
EDIT:
Solution here at my blog, if anyone is interested: