Changed primes[0] to represent the number of primes, not the length