Replaces elements from passed arrays into the first array