Computing nonsurjective primes associated to Galois representations of genus $2$ curves