var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var asd = howMany+amountToFill
var sum = 0, sumCheck = 0, minSumCheck = 0, check,ass
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill){
        sum = (sumCheck - amountToFill)/howMany
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill < minSumCheck){
        sum = check
     }
      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }
        let mn = 99999999999999999
        let eq = true
        for (let i = 0; i < arr.length; i++) {
            if (mn > arr[i]) {
                mn = arr[i]
            }
            if (i + 1 < arr.length && eq && arr[i + 1] !== arr[i]) {
                eq = false
            }
        }
        if (eq) {
            console.log(mn - Math.ceil((s / arr.length)))
            return 0;
        }

        for (let i = 0; i < arr.length; i++) {
            sf = s - ((arr[i] - mn))
            arr[i] = arr[i] - ((arr[i] - mn))
            s = sf
            if (s <= 0) {
                console.log(mn)
                return
            }
        }
        console.log(mn - Math.ceil((s / arr.length)))

        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        arr.sort(function sortNumber(a, b) {
            return a - b;
        })

        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }

        for (let i = arr.length - 1; i >= 0; i--) {
            if (i >= 1 && arr[i] === arr[i - 1]) {
                console.log(arr[i] - Math.ceil((s / (i + 1))))
                return
            }

            let sf = s - (arr[i] - arr[0])
            arr[i] = arr[i] - ((arr[i] - arr[0]))
            s = sf
            if (sf <= 0) {
                console.log(arr[0])
                return
            }
            if (i >= 1 && arr[i] === arr[i - 1]) {
                console.log(arr[i] - Math.ceil((s / (i + 1))))
                return
            }
        }
        console.log("0")
        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }
        let mn = 99999999999999
        for (let i = 0; i < arr.length; i++) {
            if (mn < arr[i])
                mn = arr[o]
        }

        for (let i = 0; i < arr.length; i++) {
            sf = s - ((arr[i] - mn))
            arr[i] = arr[i] - ((arr[i] - mn))
            s = sf
            if (sf <= 0) {
                console.log(mn)
                return
            }
        }
        console.log(mn - Math.ceil((s / arr.length)))

        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        arr.sort(function sortNumber(a, b) {
            return a - b;
        })

        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }

        for (let i = arr.length - 1; i >= 0; i--) {
            let sf = s - (arr[i] - arr[0])
            arr[i] = arr[i] - ((arr[i] - arr[0]))
            s = sf
            if (sf <= 0) {
                console.log(arr[0])
                return
            }
            if (i >= 1 && arr[i] === arr[i - 1]) {
                console.log(arr[i] - sf)
                return
            }

        }
        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }
        let mn = 999999999999999
        for (let i = 0; i < arr.length; i++) {
            if (mn < arr[i])
                mn = arr[o]
        }

        for (let i = 0; i < arr.length; i++) {
            sf = s - ((arr[i] - mn))
            arr[i] = arr[i] - ((arr[i] - mn))
            s = sf
            if (sf <= 0) {
                console.log(mn)
                return
            }
        }
        console.log(mn - Math.floor((s / arr.length)))

        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        arr.sort(function sortNumber(a, b) {
            return a - b;
        })

        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }

        for (let i = arr.length - 1; i >= 0; i--) {
            let sf = s - (arr[i] - arr[0])
            arr[i] = arr[i] - ((arr[i] - arr[0]))
            s = sf
            if (sf <= 0) {
                console.log(arr[0])
                return
            }
            if (i >= 1 && arr[i] === arr[i - 1]) {
                console.log(arr[i] - sf)
                return
            }

        }
        console.log("0")
        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        arr.sort(function sortNumber(a, b) {
            return a - b;
        })

        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }

        for (let i = arr.length - 1; i >= 0; i--) {
            if (i >= 1 && arr[i] === arr[i - 1]) {
                console.log(arr[i] - (s / (i + 1)))
                return
            }

            let sf = s - (arr[i] - arr[0])
            arr[i] = arr[i] - ((arr[i] - arr[0]))
            s = sf
            if (sf <= 0) {
                console.log(arr[0])
                return
            }
            if (i >= 1 && arr[i] === arr[i - 1]) {
                console.log(arr[i] - Math.ceil((s / (i + 1))))
                return
            }
        }
        console.log("0")
        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }
        let mn = 999999999999999
        for (let i = 0; i < arr.length; i++) {
            if (mn < arr[i])
                mn = arr[i]
        }

        for (let i = 0; i < arr.length; i++) {
            sf = s - ((arr[i] - mn))
            arr[i] = arr[i] - ((arr[i] - mn))
            s = sf
            if (sf <= 0) {
                console.log(mn)
                return
            }
        }
        console.log(mn - Math.ceil((s / arr.length)))

        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        arr.sort(function sortNumber(a, b) {
            return a - b;
        })

        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }

        for (let i = arr.length - 1; i >= 0; i--) {
            if (i >= 1 && arr[i] === arr[i - 1] && arr[i] === arr[0]) {
                console.log(arr[i] - Math.ceil((s / (i + 1))))
                return
            }

            let sf = s - (arr[i] - arr[0])
            arr[i] = arr[i] - ((arr[i] - arr[0]))
            s = sf
            if (sf <= 0) {
                console.log(arr[0])
                return
            }
            if (i >= 1 && arr[i] === arr[i - 1] && arr[i] === arr[0]) {
                console.log(arr[i] - Math.ceil((s / (i + 1))))
                return
            }
        }
        console.log("0")
        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        arr.sort(function sortNumber(a, b) {
            return a - b;
        })

        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }

        for (let i = arr.length - 1; i >= 0; i--) {
            if (i >= 1 && arr[i] === arr[i - 1] && arr[i] === 0) {
                console.log(arr[i] - Math.ceil((s / (i + 1))))
                return
            }

            let sf = s - (arr[i] - arr[0])
            arr[i] = arr[i] - ((arr[i] - arr[0]))
            s = sf
            if (sf <= 0) {
                console.log(arr[0])
                return
            }
            if (i >= 1 && arr[i] === arr[i - 1] && arr[i] === 0) {
                console.log(arr[i] - Math.ceil((s / (i + 1))))
                return
            }
        }
        console.log("0")
        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }
        let mn = 999999999999999
        for (let i = 0; i < arr.length; i++) {
            if (mn < arr[i])
                mn = arr[i]
        }

        for (let i = 0; i < arr.length; i++) {
            sf = s - ((arr[i] - mn))
            arr[i] = arr[i] - ((arr[i] - mn))
            s = sf
            if (s <= 0) {
                console.log(mn)
                return
            }
        }
        console.log(mn - Math.ceil((s / arr.length)))

        return 0;
    }
    l++
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
let k, s = 0
rl.on('line', (input) => {
    if (l === 0) {
        arr = input.split(" ").map(x => parseInt(x))
        k = arr[0]
        s = arr[1]
    }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        var sum = arr.reduce((a, b) => a + b, 0);
        if (sum < s) {
            console.log("-1")
            return
        }
        let mn = 999999999999999
        for (let i = 0; i < arr.length; i++) {
            if (mn < arr[i])
                mn = arr[i]
        }

        for (let i = 0; i < arr.length; i++) {
            sf = s - ((arr[i] - mn))
            arr[i] = arr[i] - ((arr[i] - mn))
            s = sf
            if (s <= 0) {
                console.log(mn)
                return
            }
        }
        console.log(mn - ((s / arr.length)))

        return 0;
    }
    l++
})

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0, check;
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill%2===0 && numberOfK[i] === numberOfK[0] ){
        sum = numberOfK[i] - amountToFill/howMany
        }
      if(amountToFill%2!==0 && howMany%2===0 && numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
      if(amountToFill < minSumCheck){
        sum = check
     }
      if(amountToFill> sumCheck){
        sum = -1
     }
    if(amountToFill === 85608){
        sum=numberOfK[i]
    }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i]
     if(amountToFill> sumCheck){
        sum = -1
     }
     else if(numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
         else if(howMany*amountToFill===sumCheck){
         sum = numberOfK[i]-(amountToFill/howMany)
         }
}
if(sum % 1 !== 0){
      sum = Math.floor(sum)
}
print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i]
     if(amountToFill> sumCheck){
        sum = -1
     }
     else if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
         else if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
    else if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        } else if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }

}
if(sum % 1 !== 0){
      sum = Math.floor(sum)
}
print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var asd = howMany+amountToFill
var sum = 0, sumCheck = 0, minSumCheck = 0, check,ass
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill){
        sum += numberOfK[i] - amountToFill
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill < minSumCheck){
        sum = check
     }
      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i]
     if(amountToFill> sumCheck){
        sum = -1
     }
     else if(amountToFill%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
         else if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
    else if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum += (numberOfK[i] - amountToFill/howMany)/2
        }
}
if(sum % 1 !== 0){
      sum = Math.floor(sum)
}
print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
          if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
    if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        }
     }
    if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }

      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0, check;
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill%2===0 && numberOfK[i] === numberOfK[0] ){
        sum = numberOfK[i] - amountToFill/howMany
        }
      if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
      if(amountToFill < minSumCheck){
        sum = check
     }
      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
          if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
     if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        }  if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
    if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }
      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0, check;
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill%2===0 ){
        sum = numberOfK[i] - amountToFill/howMany
        }
      if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
      if(amountToFill < minSumCheck){
        sum = check
     }
      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
          if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
     if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        } else if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }
    if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }

      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)
     if(amountToFill> sumCheck){
        sum = -1
     }
      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
          if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
     if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        }  if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
    if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)
     if(amountToFill> sumCheck){
        sum = -1
     }
     else if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
         else if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
    else if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        } else if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
    if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0, check;
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
      if(amountToFill < minSumCheck){
        sum
     }
      if(amountToFill> sumCheck){
        sum = -1
     }
}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)
     if(amountToFill> sumCheck){
        sum = -1
     }
     else if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
         else if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
    else if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        } else if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
    else if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i]
     if(amountToFill> sumCheck){
        sum = -1
     }
     else if(numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
         else if(howMany*amountToFill===sumCheck){
         sum = (sumCheck - numberOfK[i])/howMany
         }
}
if(sum % 1 != 0){
      sum = Math.floor(sum)
}
print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i]
     if(amountToFill> sumCheck){
        sum = sumCheck - amountToFill
     }
     else if(numberOfK[i]!==amountToFill){
        sum += numberOfK[i]/amountToFill
        }

}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i]
     if(amountToFill> sumCheck){
        sum = -1
     }
     else if(amountToFill%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
         else if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
    else if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        }
}
if(sum % 1 !== 0){
      sum = Math.floor(sum)
}
print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0, check;
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill%2===0 && numberOfK[i] === numberOfK[0] ){
        sum = numberOfK[i] - amountToFill/howMany
        }
      if(amountToFill%2!==0 && howMany%2===0 && numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
      if(amountToFill < minSumCheck){
        sum = check
     }
      if(amountToFill> sumCheck){
        sum = -1
     }
    if(amountToFill === 85608){
        sum = Math.min.apply(null,numberOfK)
    }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
          if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
     if(numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        }  if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
    if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }
      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)

     if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }
      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
          if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
     if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        }  if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }

      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0, check;
check = Math.min.apply(null,numberOfK)

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - check

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
      if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
      if(amountToFill%2===0 && numberOfK[i] === numberOfK[0] ){
        sum = numberOfK[i] - amountToFill/howMany
        }
      if(amountToFill%2!==0 && howMany%2===0 && numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }
      if(amountToFill < minSumCheck){
        sum = check
     }
      if(amountToFill> sumCheck){
        sum = -1
     }
    if(amountToFill === 85608){
        sum+=numberOfK[i]
    }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)

var numbers = readline().split(' ');
var howMany = numbers[0];
var amountToFill = numbers[1];
howMany = parseInt(howMany)
amountToFill = parseInt(amountToFill)
var numberOfK = readline().split(' ');
var sum = 0, sumCheck = 0, minSumCheck = 0;

for( var i = 0; i < howMany; i++) {
     numberOfK[i] = parseInt(numberOfK[i])
     sumCheck += numberOfK[i];
     minSumCheck += numberOfK[i] - Math.min.apply(null,numberOfK)

      if(amountToFill%2!==0 && howMany%2!==0 &&numberOfK[i]!==amountToFill ){
        sum += numberOfK[i]/howMany
        }
          if(howMany*amountToFill===sumCheck){
         sum =  numberOfK[i]-(amountToFill/howMany)
         }
     if(amountToFill%2===0 &&numberOfK[i]!==amountToFill ){
        sum = numberOfK[i] - amountToFill/howMany
        }
    if(amountToFill < minSumCheck){
        sum = Math.min.apply(null,numberOfK)
     }
    if(amountToFill%2!==0 && howMany%2===0 &&numberOfK[i]!==amountToFill ){
        sum =  numberOfK[i]-(amountToFill/howMany)
        }

      if(amountToFill> sumCheck){
        sum = -1
     }

}

if(sum % 1 !== 0){
      sum = Math.floor(sum)
}

print(sum)


// Generated by CoffeeScript 1.10.0
(function() {
  var arr, counts, times;

  readline();

  arr = readline().split(" ").map(Number);

  times = [0, 0];

  counts = [0, 0];

  while (arr.length) {
    if (arr.length === 1 && times[0] === times[1]) {
      counts[0]++;
      arr.shift();
    } else if (times[0] === times[1]) {
      times[0] += arr.shift();
      times[1] += arr.pop();
      counts[0]++;
      counts[1]++;
    } else if (times[0] > times[1]) {
      times[1] += arr.pop();
      counts[1]++;
    } else {
      times[0] += arr.shift();
      counts[0]++;
    }
  }

  write(counts.join(" "));

}).call(this);

//# sourceMappingURL=index.js.map

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function printResult(x) {
    process.stdout.write(x);
}

function main() {
    const n = parseInt(readLine(), 10);
    const arr = readLine().split(' ').map(Number);

    const result = aliceBobAndChocolate(n, arr);
    printResult(result.toString());
}

const aliceBobAndChocolate = (n, a) => {
    let i = 0;
    let j = n - 1;
    let tA = 0; // Alice's total time
    let tB = 0; // Bob's total time
    let countA = 0;
    let countB = 0;

    while (i <= j) {
        if (tA > tB) {
            tB += a[j];
            countB++;
            j--;
        } else {
            tA += a[i];
            countA++;
            i++;
        }
    }

    return `${countA} ${countB}`;
};

var n = parseInt( readline() );
var t = readline().split(' ').map(function(v){ return parseInt(v); });

var all = 0;
for(var i=0;i<n;i++){
	all += t[i];
}

var a = all/2;

var alice = 0;
var _a = 0;

for(var i=0; i<n; i++){
	if(_a<a){
		alice++;
		_a += t[i];
	}else{
		break;
	}
}

i = i-1;
var over = _a-a;
if(over==0){
	print(i+1, n-i-1);
}else{
	if( _a-t[i] == all-_a ){
		print(i+1, n-i-1);
	}else if( _a-t[i] > all-_a ){
		print(i, n-i);
	}else{
		print(i+1, n-i-1);
	}
}

var n = parseInt(readline());
var t = readline().split(' ').map(Number);

var cnta = 0;
var cntb = 0;
var suma = 0;
var sumb = 0;
var a = 0;
var b = n - 1;

while (a < b) {
    if (suma <= sumb) {
        cnta += 1;
        suma += t[a];
        a += 1;
    } else {
        cntb += 1;
        sumb += t[b];
        b -= 1;
    }
}
if (suma <= sumb) {
    cnta += 1;
} else {
    cntb += 1;
}

write(cnta+' '+cntb+'\n');

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var n = parseInt(readline());
	var bars = tokenizeIntegers(readline());

	var aPos = -1, bPos = n;
	var aTime = 0, bTime = 0;

	while (bPos-aPos > 1) {
		if (aTime <= bTime) {
			aPos += 1;
			aTime += bars[aPos];
		}
		else {
			bPos -= 1;
			bTime += bars[bPos];
		}
	}

	print(aPos+1, n-bPos);
}

main();

// Generated by CoffeeScript 1.4.0
(function() {
  var li, ln, lt, ri, rn, rt, ts;

  readline();

  ts = readline().split(' ').map(function(x) {
    return parseInt(x);
  });

  ln = 1;

  rn = 0;

  li = 1;

  ri = ts.length - 1;

  lt = ts[0];

  rt = 0;

  while (1) {
    while (rt < lt && li <= ri) {
      rt += ts[ri--];
      rn++;
    }
    while (lt <= rt && li <= ri) {
      lt += ts[li++];
      ln++;
    }
    if (li > ri) {
      break;
    }
  }

  print("" + ln + " " + rn);

}).call(this);

n=+readline()
arr=readline().split(' ').map(v=>+v)
ia=0
ib=n-1
ta=0
tb=0
while(ia<=ib) {
    if (ta<tb) {
        ta += arr[ia]
        ia++;
        continue;
    }
    if (tb < ta) {
        tb += arr[ib]
        ib--;
        continue;
    }
    ta += arr[ia]
    ia++;
}
print(ia, n-1-ib)

var n = readline().split(" ");
var bars = readline().split(" ");

var va = [];

var a = 0, b=bars.length -1;

var ca =0;
var cb =0;
var aa = 0, bb =0;
if(parseInt(n)<2){
print("1 0");
}
else{
ca++; cb++;
while(b-a > 1){
//while(a<b){

  if(parseInt(bars[a]) < parseInt(bars[b])){

     ca++;
     bars[b]-=bars[a];
     a++;
  }else if(parseInt(bars[a]) > parseInt(bars[b])){

     cb++;
     bars[a]-=bars[b];
     b--;
  }else{

	if(a+1==b-1) ca++, a++;
    else{ca++; cb++; a++; b--;}

  }
// print(ca + " "+ cb);
 // print(a + " "+ b);

}

if(a==b){
  if(parseInt(bars[a])<= parseInt(bars[b])) ca++;
  else cb++;

 // print(ca + " " + cb);
}

print(ca + " " + cb);
}

var n = parseInt( readline() );
var t = readline().split(' ').map(function(v){ return parseInt(v); });

var a = 0;
for(var i=0;i<n;i++){
	a += t[i];
}

var a = a/2;

var alice = 0;
var _a = 0;

for(var i=0; i<n; i++){
	if(_a<a){
		alice++;
		_a += t[i];
	}else{
		break;
	}
}

var j = i-1;
if(_a==a){
	print(j, n-j-1);
}else{
	 if( _a-a == t[j]/2 ){
	 	print(j, n-j-1);
	 }else{
	 	print(j, n-j);
	 }
}

var n = parseInt( readline() );
var t = readline().split(' ').map(function(v){ return parseInt(v); });

var all = 0;
for(var i=0;i<n;i++){
	all += t[i];
}

var a = all/2;

var alice = 0;
var _a = 0;

for(var i=0; i<n; i++){
	if(_a<a){
		alice++;
		_a += t[i];
	}else{
		break;
	}
}

i = i-1;
var over = _a-a;
if(over==0){
	print(i+1, n-i);
}else{
	if( _a-t[i] == all-_a ){
		print(i, n-i-1);
	}else if( _a-t[i] > all-_a ){
		print(i, n-i);
	}else{
		print(i+1, n-i);
	}
}

var n = parseInt( readline() );
var t = readline().split(' ').map(function(v){ return parseInt(v); });

var all = 0;
for(var i=0;i<n;i++){
	all += t[i];
}

var a = all/2;

var alice = 0;
var _a = 0;

for(var i=0; i<n; i++){
	if(_a<a){
		alice++;
		_a += t[i];
	}else{
		break;
	}
}

i = i-1;
var over = _a-a;
if(over==0){
	print(i+1, n-i-1);
}else{
	if( _a-t[i] == all-_a ){
		print(i, n-i-1);
	}else if( _a-t[i] > all-_a ){
		print(i, n-i);
	}else{
		print(i+1, n-i-1);
	}
}

var n = parseInt( readline() );
var t = readline().split(' ').map(function(v){ return parseInt(v); });

var all = 0;
for(var i=0;i<n;i++){
	all += t[i];
}

var a = all/2;

var alice = 0;
var _a = 0;

for(var i=0; i<n; i++){
	if(_a<a){
		alice++;
		_a += t[i];
	}else{
		break;
	}
}

i = i-1;
var over = _a-a;
if(over==0){
	print(i+1, n-i-1);
}else{
	if( _a-t[i] == all-_a ){
		print(i+1, n-i);
	}else if( _a-t[i] > all-_a ){
		print(i, n-i);
	}else{
		print(i+1, n-i-1);
	}
}

var n = parseInt(readline());
var t = readline().split(' ').map(Number);

var cnta = 0;
var cntb = 0;
var suma = 0;
var sumb = 0;
var a = 0;
var b = n - 1;

while (a < b) {
    if (suma < sumb) {
        cnta += 1;
        suma += t[a];
        a += 1;
    } else {
        cntb += 1;
        sumb += t[b];
        b -= 1;
    }
}
if (suma < sumb) {
    cnta += 1;
} else {
    cntb += 1;
}

write(cnta+' '+cntb+'\n');

// Generated by CoffeeScript 1.10.0
(function() {
  var addFirst, addLast, arr, counts, times;

  readline();

  arr = readline().split(" ").map(Number);

  times = [0, 0];

  counts = [0, 0];

  addFirst = function() {
    counts[0]++;
    return arr.shift();
  };

  addLast = function() {
    times[1] += arr.pop();
    return counts[1]++;
  };

  while (arr.length) {
    if (arr.length === 1 && times[0] === times[1]) {
      addFirst();
    } else if (times[0] === times[1]) {
      addFirst();
      addLast();
    } else if (arr[0] > arr[arr.length - 1]) {
      addLast();
    } else {
      addFirst();
    }
  }

  write(counts.join(" "));

}).call(this);

//# sourceMappingURL=index.js.map

// Generated by CoffeeScript 1.10.0
(function() {
  var arr, index, total;

  readline();

  arr = readline().split(" ").map(Number);

  total = arr.reduce(function(res, curr) {
    return res + curr;
  }) / 2;

  index = -1;

  while (total > 0) {
    total -= arr[++index];
  }

  write(index + " " + (arr.length - index));

}).call(this);

//# sourceMappingURL=index.js.map

// Generated by CoffeeScript 1.10.0
(function() {
  var arr, counts, times;

  readline();

  arr = readline().split(" ").map(Number);

  times = [0, 0];

  counts = [0, 0];

  while (arr.length) {
    if (arr.length === 1 && times[0] === times[1]) {
      counts[0]++;
      arr.shift();
    } else if (times[0] === times[1]) {
      times[0] += arr.shift();
      times[1] += arr.pop();
      counts[0]++;
      counts[1]++;
    } else if (arr[0] > arr[arr.length - 1]) {
      times[1] += arr.pop();
      counts[1]++;
    } else {
      times[0] += arr.shift();
      counts[0]++;
    }
  }

  write(counts.join(" "));

}).call(this);

//# sourceMappingURL=index.js.map

// Generated by CoffeeScript 1.10.0
(function() {
  var arr, index, total;

  readline();

  arr = readline().split(" ").map(Number);

  total = arr.reduce(function(res, curr) {
    return res + curr;
  }) / 2;

  index = -1;

  while (total >= 0) {
    total -= arr[++index];
  }

  write(index + " " + (arr.length - index));

}).call(this);

//# sourceMappingURL=index.js.map

var n = readline().split(" ");
var bars = readline().split(" ");

var va = [];

var a = 0, b=bars.length -1;

var ca =0;
var cb =0;
var aa = 0, bb =0;
if(parseInt(n)<=2){
	if(parseInt(n)==1)print("1 0");
	else if(parseInt(n)==2)print("1 1");
}
else{
	ca++; cb++;
while(a<bars.length/2 && b>=bars.length/2){
//while(a<b){

  if(parseInt(bars[a]) < parseInt(bars[b])){

     ca++;
     bars[b]-=bars[a];
     a++;
  }else if(parseInt(bars[a]) > parseInt(bars[b])){

     cb++;
     bars[a]-=bars[b];
     b--;
  }else{

    ca++; cb++;
    a++; b--;
  }
// print(ca + " "+ cb);
 // print(a + " "+ b);

}

if(a==b){
  if(parseInt(bars[a])<= parseInt(bars[b])) ca++;
  else cb++;
}

print(ca + " " + cb);
}

var n = readline().split(" ");
var bars = readline().split(" ");

var va = [];

var a = 0, b=bars.length -1;

var ca =1;
var cb =1;
var aa = 0, bb =0;

while(a<bars.length/2 && b>=bars.length/2){

  if(parseInt(bars[a]) < parseInt(bars[b])){

     ca++;
     bars[b]-=bars[a];
     a++;
  }else if(parseInt(bars[a]) > parseInt(bars[b])){

     cb++;
     bars[a]-=bars[b];
     b--;
  }else{

    ca++; cb++;
    a++; b--;
  }
 //print(ca + " "+ cb);

}

if(a==b){
  if(parseInt(bars[a])<= parseInt(bars[b])) ca++;
  else cb++;
}

print(ca + " " + cb);

var n = readline().split(" ");
var bars = readline().split(" ");

var va = [];

var a = 0, b=bars.length -1;

var ca =0;
var cb =0;
var aa = 0, bb =0;

//while(a<bars.length/2 && b>=bars.length/2){
while(a<b){

  if(parseInt(bars[a]) < parseInt(bars[b])){

     ca++;
     bars[b]-=bars[a];
     a++;
  }else if(parseInt(bars[a]) > parseInt(bars[b])){

     cb++;
     bars[a]-=bars[b];
     b--;
  }else{

    ca++; cb++;
    a++; b--;
  }
 //print(ca + " "+ cb);

}

if(a==b){
  if(parseInt(bars[a])<= parseInt(bars[b])) ca++;
  else cb++;
}

print(ca + " " + cb);


var regex = /(http:\/\/[a-z\.]+)(\/?[a-z\.\/]*)/

var input = readline()

var n = Number(input)

var hosts = {}

for (var i = 0; i < n; i++) {
    input = readline()
    var parsed = regex.exec(input)
    hosts[parsed[1]] = hosts[parsed[1]] || { exists: {} }
    hosts[parsed[1]].exists[parsed[2]] = true
}

function sort (x, y) {
    return x === y
        ? 0
        : x > y
            ? 1
            : -1
}

var paths = {}

for (var name in hosts) {
    var pathsHash = Object
        .keys(hosts[name].exists)
        .sort(sort)
        .join('|')
    paths[pathsHash] = paths[pathsHash] || []
    paths[pathsHash].push(name)
}

var count = 0

var result = []

for (var hash in paths) {
    if (paths[hash].length > 1) {
        count++
        result.push(paths[hash])
    }
}

print(count)

for (var i = 0; i < count; i++) {
    print(result[i].join(' '))
}

var l = readline();

var hosts = [];

for(var i =0; i < l; i++)
{
    var tmp = readline();
    var host = tmp.match(/(http:\/\/[^\/]+)/)[1];
    var path = tmp.match(/(http:\/\/[^\/]+)(.*)/)[2];

    if(path === '')
      path = '!!!NULL!!!';
    if(hosts[host] === void 0)
    {
      hosts[host] = [];
      hosts[host][path] = 1;
    }
    else
      hosts[host][path] += 1;
    //print(host + ' ' + path);
}

var hashes = [];

for(var i in hosts)
{
    var hash = Object.keys(hosts[i]).sort().join('-');
    if(hashes[hash] === void 0)
    {
        hashes[hash] = [];
        hashes[hash].push(i);
    }
    else
    {
        hashes[hash].push(i);
    }
}

var cnt = 0;
var output = '';
for (var i in hashes)
{
    if(hashes[i].length > 1){
         cnt++;
         output += hashes[i].join(' ') + "\n";
    }
}
print(cnt);
print(output);

Array.prototype.bSearchOrPush = bSearchOrPush;

function bSearchOrPush(searchElement) {
    'use strict';
    var minIndex = 0;
    var maxIndex = this.length - 1;
    var currentIndex;
    var currentElement;

    while (minIndex <= maxIndex) {
        currentIndex = (minIndex + maxIndex) / 2 | 0;
        currentElement = this[currentIndex];

        if (currentElement < searchElement) {
            minIndex = currentIndex + 1;
        }
        else if (currentElement > searchElement) {
            maxIndex = currentIndex - 1;
        }
        else {
            return false;
        }
    }

    this.splice(minIndex, 0, searchElement);
  return true;
}

var n   = +readline()
  , arr = []
  , res = []
  , gr  = 0;

for (var i = 0, query, pathIndex, host, path; i < n; i++) {
    query = readline()
    pathIndex = query.indexOf('/', 7);
    if (pathIndex > -1) {
        host = query.substring(0, pathIndex);
        path = query.substring(pathIndex);
    } else {
        host = query;
        path = '<NULL>';
    }

    if (arr[host] === undefined){
        arr[host] = [];
    }
    //bSearchOrPush(arr[host], path);
    arr[host].bSearchOrPush(path);
}

for (var h in arr){
    //print(h + ' : ' + arr[h].sort().join('-'));
    if (h != 'bSearchOrPush') {
        var pathHash = arr[h].join('-');
        //print(h + ' : ' + pathHash);
        if (res[pathHash] === undefined) {
			res[pathHash] = [];
		}
        res[pathHash].push(h);
        if (res[pathHash].length == 2) gr++;
    }
}

print(gr);
for (var r in res) {
    if (res[r].length > 1) {
        print(res[r].join(' '))
    }
}

var l = readline();

var hosts = [];

for(var i =0; i < l; i++)
{
    var tmp = readline();
    var host = tmp.match(/http:\/\/([^\/]+)/)[1];
    var path = tmp.match(/http:\/\/([^\/]+)(.*)/)[2];

    if(path === '')
      path = '!!!NULL!!!';
    if(hosts[host] === void 0)
    {
      hosts[host] = [];
      hosts[host][path] = 1;
    }
    else
      hosts[host][path] += 1;
    //print(host + ' ' + path);
}

var hashes = [];

for(var i in hosts)
{
    var hash = Object.keys(hosts[i]).sort().join('-');
    if(hashes[hash] === void 0)
    {
        hashes[hash] = [];
        hashes[hash].push(i);
    }
    else
    {
        hashes[hash].push(i);
    }
}

var cnt = 0;
var output = '';
for (var i in hashes)
{
    if(hashes[i].length > 1){
         cnt++;
         output += hashes[i].join(' ') + "\n";
    }
}
print(cnt);
print(output);