Python (Simple Deque + SortedList)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass MKAverage:\n\n    def __init__(self, m, k):\n        from sortedcontainers import SortedList\n        self.m = m\n        self.k = k\n        self.ans = deque()\n        self.res = SortedList()\n        self.total = 0\n\n    def addElement(self, num):\n        self.ans.append(num)\n        self.res.add(num)\n        self.total += num\n\n        if len(self.ans) > self.m:\n            x = self.ans.popleft()\n            self.res.remove(x)\n            self.total -= x\n\n    def calculateMKAverage(self):\n        if len(self.ans) < self.m:\n            return -1\n        else:\n            remove = sum(self.res[:self.k]) + sum(self.res[-self.k:])\n\n        return int((self.total-remove)/(self.m-2*self.k))\n\n        \n```
['Python3']