In this paper, we study the maximal length of maximal green sequences for quivers of type D and E by using the theory of tilting mutation. We show that the maximal length does not depend on the choice of the orientation and determine it explicitly. Moreover, we give a program which counts all maximal green sequences by length for a given Dynkin/extended Dynkin quiver.