Easy solution C#
\n# Complexity\n- Time complexity: O(m + n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) 
\n# Complexity\n- Time complexity: O(m + n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```csharp []\npublic class Solution {\n    public long MinSum(int[] nums1, int[] nums2) {\n        long sum1 = 0, sum2 = 0;\n        int count1 = 0, count2 = 0;\n        for(int i = 0; i < nums1.Length; i++)\n        {\n            if(nums1[i] == 0)\n            {\n                count1++;\n            }\n            sum1 += nums1[i];\n        }\n        for(int i = 0; i < nums2.Length; i++)\n        {\n            if(nums2[i] == 0)\n            {\n                count2++;\n            }\n            sum2 += nums2[i];\n        }\n        if(sum1 == sum2)\n        {\n            if(count1 == 0 && count2 == 0)\n            {\n                return sum1;\n            }\n            if(count1 == 0 || count2 == 0)\n            {\n                return -1;\n            }\n        }\n        if(sum1 > sum2)\n        {\n            if(count2 == 0 || (sum1 - sum2 < count2 && count1 == 0))\n            {\n                return -1;\n            }\n        }\n        else if(sum2 > sum1)\n        {\n            if(count1 == 0 || (sum2 - sum1 < count1 && count2 == 0))\n            {\n                return -1;\n            }\n        }\n        return Math.Max(sum1 + count1, sum2 + count2);\n    }\n}\n```\n![89f26eaf70fa927a79d4793441425859.jpg](https://assets.leetcode.com/users/images/5e28778e-2599-43c7-9047-1ef2214af096_1731578964.430267.jpeg)\n
['Array', 'C#']