Easy solution using Heap DS
Code
# Code\n```java []\nclass Solution {\n    class Pair {\n        int num;\n        int idx;\n\n        Pair(int a, int b) {\n            num = a;\n            idx = b;\n        }\n    }\n\n    public long[] unmarkedSumArray(int[] arr, int[][] q) {\n        int n = q.length;\n        int m = arr.length;\n        long[] ans = new long[n];\n\n        PriorityQueue<Pair> pq = new PriorityQueue<>((a, b) -> a.num == b.num ? a.idx - b.idx : a.num - b.num);\n        long sum = 0;\n        for (int i = 0; i < m; i++) {\n            sum += arr[i];\n            pq.add(new Pair(arr[i], i));\n        }\n\n        for (int i = 0; i < n; i++) {\n            int ind = q[i][0];\n            int k = q[i][1];\n\n            if (arr[ind] != -1) {\n                sum -= arr[ind];\n                arr[ind] = -1;\n            }\n            while (pq.size() != 0 && k != 0) {\n                Pair p = pq.poll();\n\n                if (p.idx != ind && arr[p.idx] != -1) {\n                    arr[p.idx] = -1;\n                    sum -= p.num;\n                    k--;\n                }\n            }\n\n            ans[i] = sum;\n        }\n\n        return ans;\n    }\n}\n```
['Array', 'Heap (Priority Queue)', 'Simulation', 'Java']