We show how generalized Zagreb indices $M_1^k(G)$ can be computed by using a simple graph polynomial and Stirling numbers of the second kind. In that way we explain and clarify the meaning of a triangle of numbers used to establish the same result in an earlier reference.