/*
 * sto Qingyu orz
 * 感谢真神sqy无私的教诲。膜时队者处处阿克，只因大师sqy在他背后。不膜大师者违背了真神的旨意，真神必将降下天谴,
 * 使其天天爆零
 * 我不由自主地膜拜真神sqy。
 * Author: RainAir
 * Time: 2019-10-16 10:11:35
 */
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define fi first
#define se second
#define U unsigned
#define P std::pair
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 5000+5;
const int ha = 998244353;
int cnt[MAXN];
int n,k,fac[MAXN],inv[MAXN];

inline int qpow(int a,int n=ha-2){
    int res = 1;
    while(n){
        if(n & 1) res = 1ll*res*a%ha;
        a = 1ll*a*a%ha;
        n >>= 1;
    }
    return res;
}

inline void prework(){
    fac[0] = 1;
    FOR(i,1,MAXN-1) fac[i] = 1ll*fac[i-1]*i%ha;
    inv[MAXN-1] = qpow(fac[MAXN-1]);
    ROF(i,MAXN-2,0) inv[i] = 1ll*inv[i+1]*(i+1)%ha;
}

inline int C(int n,int m){
    if(n < m) return 0;
    return 1ll*fac[n]*inv[m]%ha*inv[n-m]%ha;
}

int main(){
    scanf("%d%d",&k,&n);
    prework();
    FOR(i,1,k) cnt[i+1]++,cnt[i+k+1]--;
    FOR(i,1,2*k) cnt[i] += cnt[i-1],cnt[i-1] = (cnt[i-1]+1)/2;
//    FOR(i,1,2*k) DEBUG(cnt[i]);
    FOR(i,2,k*2){
        int ans = 0;
        FOR(j,0,std::min(cnt[i],n/2)){
            (ans += 1ll*((j&1)?ha-1:1)*C(cnt[i],j)%ha*C(n-2*j+k-1,k-1)%ha)%=ha;
        }
        printf("%d\n",ans);
    }
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  ll m = 0;
  cin >> n >> m;
  vector<ll> a(n);
  vector<ll> b(m);
  map<ll,ll> ac;
  map<ll,ll> bc;
  for(int i = 0;i < n;i++)cin >> a[i],ac[a[i]]++;
  for(int i = 0;i < m;i++)cin >> b[i],bc[b[i]]++;
  if((ll)ac.size() != n || (ll)bc.size() != m){
    cout << 0 << endl;
    return 0;
  }
  vector<ll> awa(n*m);
  vector<ll> bwa(n*m);
  for(int i = n*m - 1;i >= 0;i--){
    if(ac[i + 1] == 1)awa[i] = 1;
    if(i != n*m - 1)awa[i] += awa[i + 1];
  }
  for(int i = n*m - 1;i >= 0;i--){
    if(bc[i + 1] == 1)bwa[i] = 1;
    if(i != n*m - 1)bwa[i] += bwa[i + 1];
  }
  ll res = 1;
  ll mod = pow(10,9) + 7;
  for(int i = n*m - 1;i >= 0;i--){
    if(ac[i + 1] == 1 && bc[i + 1] == 0)res *= max((ll)0,bwa[i + 1]);
    if(ac[i + 1] == 0 && bc[i + 1] == 1)res *= max((ll)0,awa[i + 1]);
    if(ac[i + 1] == 0 && bc[i + 1] == 0)res *= max((ll)0,awa[i + 1] * bwa[i + 1] - (n*m - i - 1));
    res %= mod;
  }
  cout << res << endl;
}