From NASO "Ask Us", 6 December 1999:
(the play is the same as presented here)
After the officials' red faces fade away for allowing the teams to line up improperly, the free throw is cancelled and team A is awarded the ball via the AP because there was a double free throw violation [one free throw was awarded in this particular case; the AP arrow favored A].
Since team B's coach will probably demand an explanation, he [sexist pigs!

] must be advised that team B violated first by not occupying the endline spaces, and team A violated last because they are not allowed to occupy the first lane space under any circumstance. One other little thing: It better be detected before the free throw ends or it'll be too late to call the violations.
Fortunately double free throw violations do not occur frequently and it's prudent to remember that the defense must violate forst and the offense next or there can't be a double violation. Ifteam A violates first, the party is over as the ball is dead and the free throw is over.
Federation and NCAA rules agree. (Fed 9-1-2, Penalty 3;NCAA 9-1-C, 9-2-c)