public int FindKthSmallestSum(int[] m, int[] n, int k)

{

```
if (m.Length == 0 || n.Length == 0 || k <=0 )
{
throw new ArgumentException("Invalid Argument");
}
var sum = m[0] + n[0];
var rank = 1;
var i =0;
var j =0;
while (i < m.Length && j < n.Length)
{
if (m[i] + n[j] > sum)
{
sum = m[i] + n[j];
rank++;
}
if (rank == k)
{
break;
}
if (i == m.Length - 1)
{
j++;
}
else if (j == n.Length - 1)
{
i++;
}
else if(m[i +1] + n[j] > m[i] + n[j+1] )
{
j++;
var tmp = m[i] + n[j] ;
while (i != 0 && m[i - 1] + n[j] < tmp && m[i - 1] + n[j] > sum)
{
i--;
}
}
else
{
i++;
var tmp = m[i] + n[j];
while (j != 0 && m[i] + n[j - 1] < tmp && m[i] + n[j - 1] > sum)
{
j--;
}
}
}
if (rank < k)
{
throw new ArgumentException(string.Format("There is no {0}th smallest sum",k));
}
return sum;
}
```