Answer
A : knave
B : knight.
Work Step by Step
Method: Reductio Ad Absurdum (Proof by contradiction)
Hypothesis: Let us suppose, on the contrary, that A is a knight.
Thus, A spoke the truth and hence A and B are both knights(That's what A said).
Thus B also spoke the truth (being a knight) which means A is a knave (that;s what B said).
So, we have encountered a contradiction due to our faulty hypothesis.
Hence, A is not a knight but is a knave which means B is a knight as he spoke truth