BM algorithm is finished