Just a runnable solution
Code\n\nimpl Solution {\n    pub fn min_moves(nums: Vec<i32>, k: i32) -> i32 {\n        let k = k as usize;\n        let mut a = Vec::new();\n        for (i, &n
# Code\n```\nimpl Solution {\n    pub fn min_moves(nums: Vec<i32>, k: i32) -> i32 {\n        let k = k as usize;\n        let mut a = Vec::new();\n        for (i, &num) in nums.iter().enumerate() {\n            if num == 1 {\n                a.push(i as i64);\n            }\n        }\n        let mut b = vec![0];\n        for &num in a.iter() {\n            b.push(b.last().unwrap() + num);\n        }\n        let mut res = 2e9 as i64;\n        for i in 0..a.len() - k + 1 {\n            res = res.min(b[i + k] - b[k / 2 + i] - b[(k + 1) / 2 + i] + b[i]);\n        }\n        res -= ((k / 2) * ((k + 1) / 2)) as i64;\n        res as _\n    }\n}\n```
['Rust']