How to attach a group of keyframes to a marker?

The beginning of the animation is the beginning of the composition. The end of the animation (as planned) must be adjusted by the user. How to attach a selected group of keyframes to a marker (OUT)? Can this be implemented? Please help or direct to the necessary resources. Also, I apologize for the English translation of Google:3
PS: I’m not sure that in this case a time remap is suitable. Because in the interval between input and output, animation occurs.

Hi. This is possible. But it requires insane amount of time and good knowledge of expressions. Mostly work with: linear(), valueAtTime(), marker.key(name).time. Few years ago I’ve done script that automate this process (can’t put link here, it’s forbidden), but it works with keys as controllers, not with markers. Also I’ve done similar thing with several markers, you may study the code here. It requires several markers, and two layers. “assistant” layer marks where your source animation is. “controller” layer with its markers moves the original animation. But as I see now, this code is not ideal, and requires refactoring and some other major changes.
So my advice would be: Do not waste your time. If some part of your project can’t be modified simply, then don’t implement this feature. Put your time to make item awesome.