If $$$a_i$$$ $$$=$$$ $$$b_i$$$, do nothing. Otherwise, if $$$a_i$$$ $$$<$$$ $$$b_i$$$, check if we had some $$$a_i$$$ equal to $$$1$$$, otherwise, check if we had some $$$a_i$$$ equal to $$$-1$$$, this information can be kept while we iterate through the elements.

Simulate the bubble sort algorithm(assume characters equal to $$$R$$$ are $$$1$$$ and characters equal to $$$L$$$ are $$$0$$$) and keep track of steps done. If we have done less swaps than $$$k$$$ or we can't finish the algorithm in at most $$$k$$$ days, the answer is $$$-1$$$.

Otherwise, we are going to greedily unify swaps from the same day in order to finish the algorithm in $$$k$$$ days.