Counting values next to a bool cell

Let’s take a table as an example

image description

how would I go about summing up values from column A that are in the same row as 1’s in the B column.
All values in column B are boolean.

You have many possibilities:


Pay attention to the curly braces around the last formula - this is an array formula, the input must end with Ctrl+Shift+Enter