arreglar kmp off by one