Python3 solution
Code\npython3\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        zero1, zero2 = 0, 0\n        min1, min2 = 0, 0\n      
# Code\n```python3\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        zero1, zero2 = 0, 0\n        min1, min2 = 0, 0\n        for v in nums1:\n            if v == 0:\n                zero1 += 1\n                min1 += 1\n            else:\n                min1 += v\n        for v in nums2:\n            if v == 0:\n                zero2 += 1\n                min2 += 1\n            else:\n                min2 += v\n        if zero1 > 0 and zero2 > 0:\n            return max(min1, min2)\n        elif zero1 > 0:\n            if min1 > min2:\n                return -1\n            else:\n                return min2\n        elif zero2 > 0:\n            if min2 > min1:\n                return -1\n            else:\n                return min1\n        else:\n            if min1 == min2:\n                return min1\n            else:\n                return -1\n```
['Python3']