Moved handling of k=2 after duplicate check.