<!DOCTYPE html>
<html>
<script language="javascript">
    function recibir() {
        var valor = document.getElementById("texto").value;
        document.getElementById("txt").innerHTML = valor;
        array = valor.split([' ']);
        for (var i = 0; i < array.length; i++) {
            array[i] = parseInt(array[i]);
        }
        var audioOutputs = array[0];
        var friends = array[1];
        var flag = false;
        var aux = 1;
        for (var j = 0; flag === false; j++) {
            adapters = audioOutputs * aux - j;
            if (adapters >= friends) {
                flag = true;
            } else {
                aux = aux + 1;
            }
        }
        console.log(j);
    }
</script>

<body>
    <form id="formulario" method="Post">
        <input type="text" id="texto" />
        <input type="button" name="enviar" value="Enviar" onclick="recibir();" /><br>
        <div id="txt"></div>
    </form>

</body>

</html>