Easy Explanation || C++ || O(n)
IntuitionIntuition of the problem is to minimize the maximum sum,
as, we observe if we have zero count more than one for the, max sum between those two nums.
No
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Intuition of the problem is to minimize the maximum sum,
as, we observe if we have zero count more than one for the, max sum between those two nums.
Now the second part of the question is to get identify the `-1` case 
may be my solution is little big, it simplify all the required conditions where we can have `-1`.
# Approach
<!-- Describe your approach to solving the problem. -->
1. Simply count respective sum and count the zero.
2. Then check all the condition where we can have `-1` output.

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
$$O(n)$$

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
$$O(1)$$

# Code
```cpp []
class Solution {
public:
    long long minSum(vector<int>& nums1, vector<int>& nums2) {
        long long cz1 = 0;
        long long cz2 = 0;
        long long s1 = 0;
        long long s2 = 0;
        for(auto x: nums1) {
            if(x == 0) cz1++;
            s1+=x;
        }
        for(auto x: nums2) {
            if(x == 0) cz2++;
            s2+=x;
        }
        if(s1 == s2 and cz1 == cz2) {
            return max(s1+cz1,s2+cz2);
        }
        if(s1 >= s2 and cz2 == 0) {
            if(s1-s2 < cz1) return -1;
            return -1;
        }
        if(s2 >= s1 and cz1 == 0){
            if(s2-s1 < cz2) return -1;
            return -1;
        }
        if(s2 >= s1 and cz2 == 0){
            if(s2-s1 < cz1) return -1;
        }
        if(s1 >= s2 and cz1 == 0){
            if(s1-s2 < cz2) return -1;
        }
        return max(s1+cz1,s2+cz2);
    }
};
```
['C++']