You could concatenate both files, then remove the part that you don't need:
sox A B O trim 0 17 43
In a bash shell, this can be fully automated like so:
sox A B O trim 0 $(( $(soxi -s A) - $(soxi -s B) ))s $(soxi -s B)s
Here, soxi -s file
is used to determine the file length in samples. Another possibility, using a second sox instance in a pipe special input file:
sox "| sox A -p trim 0 -$(soxi -s B)s" B O