Sum category like dictionary
Hi folks. I need to sum the category, where each category have it's value. Screens below as example, first (b1:b2) is list what I need to sum:
second is value of categories (A is category, B is Value):
So I need sum from first image B1+B2 like it's equal to 20 from second image