Your march: time your troops need to reach the castle if you send now.
Enemy march: time the enemy rally will need to reach the castle after the 5-minute rally launches.
Enemy arrival = rally end (now or in 5:00) + enemy march.
Your send time = enemy arrival − your march.
If your march ≥ enemy march → send before rally ends when rally has (your−enemy) seconds left.
If your march < enemy march → send after rally launches when enemy march has your seconds left.