With electrons in an orbital, its energy is composed of two components: kinetic energy and potential energy. As many have mentioned before, the kinetic energy of the electron is related to the curvature of the wavefunction and B clearly has a greater curvature and therefore more kinetic energy than A.
What about potential energy? Here, the potential energy increases (becomes less negative) as the average position from the nucleus increases. Here, A is on avreage farther from the nucleus than B, so A has more potential energy than B.
Which one has more overall energy? Well, that depends on whether potential energy or kinetic energy dominates. Clearly, the potential energy term must be greater than the kinetic energy term or else the electron would not be bound by the atom and fly off into space. Therefore because the potential energy term has more importance than the kinetic energy term and A has more potential energy than B, the electron with wavefunction A has a higher overall energy than an electron in wavefunction B.