Let πw denote the failure function of the Knuth-Morris-Pratt algorithm for a word w. In this paper we study the following problem: given an integer array A [1 . . n], is there a word w over arbitrary alphabet Σ such that A [i] = πw[i] for all i? Moreover, what is the minimum cardinality of Σ required? We give an elementary and self-contained O(n log n) time algorithm for this problem, thus improving the previously known solution [6], which had no polynomial running time bound. Then, using both a deeper combinatorial insight into the structure of π and more advanced tools, we improve the running time to O(n).