代码:
#include <iostream>
#include <string>
#include<stdio.h>
#include<cmath>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
int a[22];
int c[22];
c[0]=1;
for(int i=1;i<=n;i++){
cin>>a[i];
c[i]=c[i-1]*a[i];
}
int b[22];
int temp=0;
for(int i=1;i<=n;i++){
b[i]=(m%c[i]-temp)/c[i-1];
temp=temp+c[i-1]*b[i];
cout<<b[i]<<" ";
}
}