def getMoneySpent(keyboards, drives, b):
     buy = -1
    
    for k in keyboards:
        if k < b:
            for d in drives:
                if k + d <= b:
                    buy = max(buy, k + d)
                
    return buy