Like people and the foods they eat, any organism that gets energy from foods will find that there must be excess N and P in those foods that later get excreted.
The simplistic reason is that one cannot convert the N and P in foods into new tissues (thus not excreting them) without some source of energy. Thst source of energy must be more food, which means more N and P, in an endless cycle.
Additionally, organisms need energy for a lot of other processes, such as movement, maintaining osmotic balance, producing eggs, etc. All that additional energy comes from metabolism of organics in more foods, and does not consume N and P. Thus, the excess N and P must be excreted.