Imports System
Imports System.Linq

Class Program
    Shared Sub Main(args As String())
        Dim input As String() = Console.ReadLine().Split(" ")
        Dim n As Long = CLng(input(0))
        Dim m As Long = CLng(input(1))
        Dim k As Long = CLng(input(2))
        Dim ai = Console.ReadLine().Split(" ")
        Dim bi = Console.ReadLine().Split(" ")
        Dim cntA As Long = 0
        Dim cntB As Long = 0

        Do While True
            If n = cntA Then
                If m = cntB Then
                    Exit Do
                ElseIf CLng(bi(cntB)) <= k Then
                    k -= CLng(bi(cntB))
                    cntB += 1
                Else
                    Exit Do
                End If

            ElseIf m = cntB Then
                If CLng(ai(cntA)) <= k Then
                    k -= CLng(ai(cntA))
                    cntA += 1
                Else
                    Exit Do
                End If

            Else
                If {CLng(ai(cntA)), CLng(bi(cntB))}.Min <= k Then
                    k -= {CLng(ai(cntA)), CLng(bi(cntB))}.Min
                    If CLng(ai(cntA)) = {CLng(ai(cntA)), CLng(bi(cntB))}.Min Then
                        cntA += 1
                    Else
                        cntB += 1
                    End If
                Else
                    Exit Do
                End If

            End If
        Loop

        Console.WriteLine(cntA + cntB)
    End Sub
End Class