Maximum element in k element subarray of a given array