M Arrays Hackerrank Solution In Python