#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; }}