Simple python solution
\n\n# Complexity\n- Time complexity: 0(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: (1)\n Add your space complexity here, e.g. O(n) \n\
\n\n# Complexity\n- Time complexity: 0(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: (1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        counts1 = nums1.count(0)\n        counts2 = nums2.count(0)\n        sum1 = sum(nums1)\n        sum2 = sum(nums2)\n\n        if (counts1 == 0 and sum2 + counts2 > sum1) or (counts2 == 0 and sum1 + counts1 > sum2):\n            return -1\n\n        return max(sum2 + counts2, sum1 + counts1) \n```
['Python3']