Pergunta de entrevista da empresa Amazon

Given an array of integers, write code (you choose the language) that will return the minimum number of elements that must be changed such that every subarray of a given length will have the same sum.