java clean and easy solution
please upvote if you like the solution it is clear if you dont understand take a pen and paper and dryrun the example test cases for more better understanding. 
please upvote if you like the solution it is clear if you dont understand take a pen and paper and dryrun the example test cases for more better understanding. Thankyou ;)\n```\nclass Solution {\n    public long minSum(int[] nums1, int[] nums2) {\n        long n = nums1.length;\n        long m = nums2.length;\n        \n        long zeros_1 = 0;\n        long zeros_2 = 0;\n        \n        long sum_1 = 0;\n        long sum_2 = 0;\n        \n        for(int i=0; i<n; i++){\n            sum_1 += nums1[i];\n            if(nums1[i] == 0){\n                sum_1++;\n                zeros_1++;\n            }\n        }\n        \n        for(int i=0; i<m; i++){\n            sum_2 += nums2[i];\n            if(nums2[i] == 0){\n                sum_2++;\n                zeros_2++;\n            }\n        }\n        \n        if(sum_1 == sum_2){\n            return sum_1;\n        }else{\n            if(sum_1 < sum_2){\n                if(zeros_1 > 0){\n                    return sum_2;\n                }else{\n                    return -1;\n                }\n            }else{\n                if(zeros_2 > 0){\n                    return sum_1;\n                }else{\n                    return -1;\n                }\n            }\n        }\n        \n    }\n}\n```
['Greedy', 'Java']