#43129: __延平


yp11351279@yphs.tp.edu.tw (711-44 韓沐捷)


#include <iostream>
using namespace std;
int main()
{
    int m,t;
    cin>>m;
    while(cin>>t, t!=0)
    {
        if(t%m==0)
            cout<<t/m<<endl;
        else
            cout<<m-t%m<<endl;
    }
}