Update KMP Algorithm