In music, a countersubject is a melodic or thematic idea which is played against a primary subject of a fugue, ricercar, invention, sinfonia, or other contrapuntal piece of music. Generally a countersubject contrasts in character to a principal subject, so if the primary subject is a stately one in long note values, the countersubject is likely to be rhythmically more active, and vice-versa.
In a work which is not formally contrapuntal, i.e. not a fugue or an invention, a secondary theme playing against a primary theme is usually termed a countermelody.
The countersubject works primarily on the level of the two beats: its basic unit is the dotted quarter note representing the three sub beats as one large beat.
The countersubject is also chromatic: it uses notes outside the scale of G-sharp-minor, accidentals in between the standard notes.
In a non-related observation, notice that the first subject is a sequence, built from the simple repetition of a motive by moving it upward one step.