finished the detail of kmp