69th solution lol , beats 99% in runtime
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 Solution:\n    def minMoves(self, nums: List[int], k: int) -> int:\n        if k == 1 or len(nums) == k:\n            return 0\n\n        indices = [idx for idx, num in enumerate(nums) if num == 1]\n        mid = k // 2\n        odd = k % 2\n        extra_steps = (mid + odd) * mid\n        min_swaps = mid_steps = sum(indices[mid+odd:k])-sum(indices[:mid])\n        if mid_steps == extra_steps:\n            return 0\n\n        end = k\n        start = 0\n        for idx in range(mid, len(indices) - k + mid):\n            # 2 rolling sums\n            mid_steps += indices[start] - indices[idx] + indices[end] - indices[idx+odd]\n            start += 1\n            end += 1\n            if mid_steps == extra_steps:\n                return 0\n            elif min_swaps > mid_steps:\n                min_swaps = mid_steps\n\n        return min_swaps - extra_steps\n```
['Python3']