#include<bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define M 1000000007
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define f first
#define s second
#define b begin
#define e end
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(i=a;i<b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define itfr(it,x) for(it=x.begin();it!=x.end();it++)
#define flash ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

int main()
{
    flash;
    //sieve();
    int T=1,t,n,m,k,i;
    // cin>>T;
    while(T--)
    {
        cin>>n>>k;
        int a[10]={0};
        FOR(i,0,k){
          cin>>t;
          a[t]=1;
        }
        vector<int> vs;
        FOR(i,0,10)
            if(a[i]==0)
                vs.pb(i);
        // for(auto it:vs)cout<<it<<" ";cout<<endl;
        int dg=0;
        for(i=n;i>0;i/=10)dg++;
        ll ans=0;
        k = pow(10,dg-1);
        int fl=0;
        int num=n;
        // cout<<dg<<" "<<k<<endl;
        while(ans<num)
        {
            if(k==0){
                ans = ans*10 + vs[0];
                continue;
            }
            m = n/k;
            n = n%k;
            k/=10;
            if(a[m]==0&fl==0){
                ans = ans*10 + m;
                continue;
            }
            dg=0;
            if(fl==0)
            {
                for(auto it:vs)
                    if(it>=m)
                    {
                        dg=it;
                        break;
                    }
                if(dg==0)
                {
                    if(vs[0]!=0)
                        dg=vs[0];
                    else
                    {
                        if(ans==0)
                            dg=vs[1];
                        else
                            dg=vs[0];
                    }
                }
                ans = ans*10+dg;
                fl=1;
            }
            else
            {
                ans = ans*10 + vs[0];
            }
        }
        cout<<ans<<endl;
    }
}
#include<bits/stdc++.h>
#define ll long long int
#define f first
#define s second
#define pb push_back
#define PII pair<ll,ll>
ll const MOD = 998244353;
ll const N = 1000005;
ll const LN = 20;
ll const inf = 8e18;
using namespace std;

ll n, m, a[N];

ll cnt[N];


ll fact[N];
ll ifact[N];
ll bexpo (ll x, ll n, ll m)
{
	ll r = 1;
	x = x % m;
	while (n > 0)
	{
		if (n % 2) { r = (r * x) % m; }
		x = (x * x) % m;
		n = n / 2;
	}
	return r;
}
ll ncr (ll n, ll r)
{
	if (r > n) { return 0; }
	ll ans = fact[n];
	ans = (ans * ifact[r]) % MOD;
	ans = (ans * ifact[n - r]) % MOD;
	return ans;
}
void pre()
{
	fact[0] = 1;
	ifact[0] = 1;
	for (ll i = 1; i < N; i++) { fact[i] = (fact[i - 1] * i) % MOD; }
	ifact[N - 1] = bexpo (fact[N - 1], MOD - 2, MOD);
	for (ll i = N - 2; i > 0; i--)
	{ ifact[i] = (ifact[i + 1] * (i + 1)) % MOD; }
}
int main()
{
	ios::sync_with_stdio (false);
	cin.tie (NULL);
	pre();
	ll n, k;
	cin >> k >> n;
	for (ll i = 2; i <= 2 * k; i++)
	{
		set<ll>st;
		for (ll j = 1; j <= k; j++)
		{
			if (j >= i)
			{
				continue;
			}
			ll oo = i - j;
			if (oo > k) { continue; }
			st.insert (oo);
			st.insert (j);
		}
		cnt[i] = (st.size() + 1) / 2;
	}
	for (ll i = 2; i <= 2 * k; i++)
	{
		if (1)
		{
			ll tot = ncr (n + k - 1, k - 1);
			for (ll j = 1; j <= cnt[i]; j++)
			{
				ll temp = ncr (cnt[i], j);
				temp *= ncr (n - 2 * j + k - 1, k - 1);
				temp %= MOD;
				if (j % 2) { tot -= temp; }
				else { tot += temp; }
				tot %= MOD;
				if (tot < 0) { tot += MOD; }
			}
			cout << tot << '\n';
		}
	}
	return 0;
}
