The NuSTAR Extragalactic Surveys: The Number Counts of Active Galactic Nuclei and the Resolved Fraction of the Cosmic X-Ray Background