beats 98% runtime, 80% memory
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    public long minSum(int[] nums1, int[] nums2) {\n        long zero1 = 0;\n        long zero2 = 0;\n        long sum1 = 0;\n        long sum2 = 0;\n        for (int num : nums1) {\n            sum1 += num;\n            if (num == 0) zero1++;\n        }\n        for (int num : nums2) {\n            sum2 += num;\n            if (num == 0) zero2++;\n        }\n        if ((sum1 + zero1 > sum2 && zero2 == 0) || (sum2 + zero2 > sum1 && zero1 == 0)) return -1;\n        if (sum1 >= sum2 + zero2 && zero1 == 0) return sum1;\n        if (sum2 >= sum1 + zero1 && zero2 == 0) return sum2;\n        if (sum1 + zero1 >= sum2 + zero2) return sum1 + zero1;\n        if (sum2 + zero2 >= sum1 + zero1) return sum2 + zero2;\n        return -1;\n    }\n}\n```
['Java']