Two arrays maths puzzle