Therefore K can be any number between and . For each such value of K, we can give one piece of cake to each of those K children. There will then be N–K remaining pieces of cake, which allows N–K lucky children to receive a second piece of cake.
There are ways of choosing the children who receive at least one piece. For each such choice, there are ways to choose the lucky children who get 2 pieces. Thus the total number of ways of allocating the cakes is . I don't see any way to simplify that answer.