Imports System

Module Program
    Sub Main(args As String())

        Dim NMK() As Integer = Console.ReadLine().Split(" ").Select(Function(x) Integer.Parse(x)).ToArray()
        Dim A() As Integer = Console.ReadLine().Split(" ").Select(Function(x) Integer.Parse(x)).ToArray()
        Dim B() As Integer = Console.ReadLine().Split(" ").Select(Function(x) Integer.Parse(x)).ToArray()

        Dim LstA As New List(Of Integer)
        For Each BookA As Integer In A
            LstA.Add(BookA)
        Next

        Dim LstB As New List(Of Integer)
        For Each BookB As Integer In B
            LstB.Add(BookB)
        Next

        Dim t As Integer = NMK(2)
        Dim ans As Integer = 0
        Dim iA As Integer = 0
        Dim iB As Integer = 0
        Do Until t <= 0
            If iA < LstA.Count Then
                If iB < LstB.Count Then
                    If LstA(iA) <= LstB(iB) Then
                        t -= LstA(iA)
                        iA += 1
                    Else
                        t -= LstB(iB)
                        iB += 1
                    End If
                Else
                    t -= LstA(iA)
                    iA += 1
                End If
            Else
                If iB < LstB.Count Then
                    t -= LstB(iB)
                    iB += 1
                Else
                    Exit Do
                End If
            End If
            If t >= 0 Then
                ans += 1
            End If
        Loop

        Console.WriteLine(ans)

    End Sub

End Module
