#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds; // order of key(keys strictly less than) // find_by_order
//typedef tree<long long,null_type,less<>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//typedef tree<long long, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;
//IF WA CHECK FOR : -
// 1 > EDGE CASES LIKE N=1 , N=0
// 2 > SIGNED INTEGER OVERFLOW IN MOD
// 3 > CHECK THE CODE FOR LOGICAL ERRORS AND SEG FAULTS
// 4 > READ THE PS ONCE AGAIN , if having double diff less than 1e-8 is same.
// 5 > You Have got AC .
#define ll long long
#define NUM (ll)998244353
#define inf (long long)(2e18)
#define ff first
#define ss second
#define f(i,a,b) for(ll i=a;(i)<long(b);(i)++)
#define fr(i,a,b) for(ll i=a;(i)>=(long long)(b);(i)--)
#define it(b) for(auto &it:(b))
#define pb push_back
#define mp make_pair
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
ll binpow( ll base , ll ex,ll mod=NUM) {
ll ans = 1;base = base % mod;
if(base==0){
return 0;
}
while (ex > 0) {
if (ex % 2 == 1) {
ans = (ans * base) % mod;
}
base = (base * base) % mod;
ex = ex / 2;
}
return ans;
}
void read(vll &arr,ll n) {
if (arr.size() != n) { arr.assign(n, 0); }for (int i = 0; i < n; i++)cin >> arr[i];
}
inline ll min(ll a,ll b){
if(a>b)return b;return a;
}
inline ll max(ll a, ll b){
if(a>b)return a;return b;
}
inline ll dif(ll a,ll b) {
if (a > b)return a - b;return b - a;
}
long long gcd(long long a,long long b) {
if (b == 0)return a;return gcd(b, a % b);
}
long long lcm(long long a,long long b) {
long long k = gcd(a, b);
return (a * b) / k;
}
void solve() {
ll n,m;
cin>>n>>m;
vector<ll> a;read(a,n+1);
vector<ll>c(n+m+1);read(c,n+m+1);
vector<ll> b(m+1);
b[0]=c[0]/a[0];
f(j,1,m+1){
ll curr = c[j];
f(k,0,j){
if(j-k>=a.size() or k>=b.size()){
continue;
}
curr-=(b[k]*a[j-k]);
}
b[j]=curr/a[0];
}
f(i,0,m){
cout<<b[i]<<" ";
}
cout<<b[m];
cout<<"\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout << fixed << showpoint;
cout << setprecision(12);
long long test_m = 1;
int k=1;
//cin >> test_m;
//WE WILL WIN .
while (test_m--) {
//cout<<"Case #"<<k++<<": ";
solve();
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKLy8jaW5jbHVkZSA8ZXh0L3BiX2RzL2Fzc29jX2NvbnRhaW5lci5ocHA+IC8vIENvbW1vbiBmaWxlCi8vI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+IC8vIEluY2x1ZGluZyB0cmVlX29yZGVyX3N0YXRpc3RpY3Nfbm9kZV91cGRhdGUKLy91c2luZyBuYW1lc3BhY2UgX19nbnVfcGJkczsgLy8gIG9yZGVyIG9mIGtleShrZXlzIHN0cmljdGx5IGxlc3MgdGhhbikgIC8vIGZpbmRfYnlfb3JkZXIKLy90eXBlZGVmIHRyZWU8bG9uZyBsb25nLG51bGxfdHlwZSxsZXNzPD4scmJfdHJlZV90YWcsdHJlZV9vcmRlcl9zdGF0aXN0aWNzX25vZGVfdXBkYXRlPiBvcmRlcmVkX3NldDsKLy90eXBlZGVmIHRyZWU8bG9uZyBsb25nLCBudWxsX3R5cGUsIGxlc3NfZXF1YWw8PiwgcmJfdHJlZV90YWcsIHRyZWVfb3JkZXJfc3RhdGlzdGljc19ub2RlX3VwZGF0ZT4gaW5kZXhlZF9tdWx0aXNldDsKLy9JRiBXQSBDSEVDSyBGT1IgOiAtCi8vIDEgPiBFREdFIENBU0VTIExJS0UgTj0xICwgTj0wCi8vIDIgPiBTSUdORUQgSU5URUdFUiBPVkVSRkxPVyBJTiBNT0QKLy8gM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KCkgIT0gbikgeyBhcnIuYXNzaWduKG4sIDApOyB9Zm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspY2luID4+IGFycltpXTsKfQppbmxpbmUgbGwgbWluKGxsIGEsbGwgYil7CiAgICBpZihhPmIpcmV0dXJuIGI7cmV0dXJuIGE7Cn0KaW5saW5lIGxsIG1heChsbCBhLCBsbCBiKXsKICAgIGlmKGE+YilyZXR1cm4gYTtyZXR1cm4gYjsKfQppbmxpbmUgbGwgZGlmKGxsIGEsbGwgYikgewogICAgaWYgKGEgPiBiKXJldHVybiBhIC0gYjtyZXR1cm4gYiAtIGE7Cn0KbG9uZyBsb25nIGdjZChsb25nIGxvbmcgYSxsb25nIGxvbmcgYikgewogICAgaWYgKGIgPT0gMClyZXR1cm4gYTtyZXR1cm4gZ2NkKGIsIGEgJSBiKTsKfQpsb25nIGxvbmcgbGNtKGxvbmcgbG9uZyBhLGxvbmcgbG9uZyBiKSB7CiAgICBsb25nIGxvbmcgayA9IGdjZChhLCBiKTsKICAgIHJldHVybiAoYSAqIGIpIC8gazsKfQp2b2lkIHNvbHZlKCkgewogICAgbGwgbixtOwogICAgY2luPj5uPj5tOwogICAgdmVjdG9yPGxsPiBhO3JlYWQoYSxuKzEpOwogICAgdmVjdG9yPGxsPmMobittKzEpO3JlYWQoYyxuK20rMSk7CiAgICB2ZWN0b3I8bGw+IGIobSsxKTsKICAgIGJbMF09Y1swXS9hWzBdOwogICAgZihqLDEsbSsxKXsKICAgICAgICBsbCBjdXJyID0gY1tqXTsKICAgICAgICBmKGssMCxqKXsKICAgICAgICAgICAgaWYoai1rPj1hLnNpemUoKSBvciBrPj1iLnNpemUoKSl7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjdXJyLT0oYltrXSphW2ota10pOwogICAgICAgIH0KICAgICAgICBiW2pdPWN1cnIvYVswXTsKICAgIH0KICAgIGYoaSwwLG0pewogICAgICAgIGNvdXQ8PGJbaV08PCIgIjsKICAgIH0KICAgIGNvdXQ8PGJbbV07CiAgICBjb3V0PDwiXG4iOwp9CmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKE5VTEwpOwogICAgY291dCA8PCBmaXhlZCA8PCBzaG93cG9pbnQ7CiAgICBjb3V0IDw8IHNldHByZWNpc2lvbigxMik7CiAgICBsb25nIGxvbmcgdGVzdF9tID0gMTsKICAgIGludCBrPTE7CiAgICAvL2NpbiA+PiB0ZXN0X207CiAgICAvL1dFIFdJTEwgV0lOIC4KICAgIHdoaWxlICh0ZXN0X20tLSkgewogICAgICAgIC8vY291dDw8IkNhc2UgIyI8PGsrKzw8IjogIjsKICAgICAgICBzb2x2ZSgpOwogICAgfQp9