If A were a knight, he would be telling the truth, therefore both A and B should be knights. Nevertheless, since B is stating that they are from two different types, he would be lying, and this cannot be true since B is a knight. We conclude that A has to be a knave and therefore B is a knight.