#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD 1000000007
#define MOD2 1000000009
#define endl "\n"
#define pii pair <int, int>
#define pll pair <ll, ll>
#define F first
#define S second

map<ll, ll> dp, vis;
ll ans = 1e18;
ll solve(ll x, ll y) {
    
    if(vis[y]) {
        return dp[y];
    }
    vis[y] = 1;
    dp[y] = 1e18;
    dp[y] = min(dp[y], abs(x - y));
    if(x == y)
        return dp[y];
    if(y % 2 == 0)
        return dp[y] = min(dp[y], 1 + solve(x, y / 2));

    return dp[y] = min(dp[y], 1 + min(solve(x, y - 1), solve(x, y + 1)));

    return dp[y];
}

int main()
{
    IOS;
        #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
        #endif

   /* int t;
    cin >> t;
    while(t--) {
        
    }*/
    ll x, y;
    cin >> x >> y;
    cout << solve(x, y);

    



    
    return 0;
}







#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
constexpr int inf=1000001000;
constexpr ll INF=2e18;
constexpr ll mod=1000000007;
// ll MOD=998244353;
const ll MOD=998244353;

void Add(int &a, int b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
}
 
void Mul(int &a, int b) {
  a = 1LL * a * b % MOD;
}
 
int Pow(int b, int e) {
  if (e < 0) e += MOD - 1;
  int ret = 1;
  while (e) {
    if (e & 1) ret = 1LL * ret * b % MOD;
    b = 1LL * b * b % MOD;
    e >>= 1;
  }
  return ret;
}

int main() {
    int n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    // vector<vector<ll>> b(n,vector<ll>(k+1,1));
    vector<ll> b(n,1);
    vector<ll> e(k+5,0);
    rep(i,k+1) e[i]=Pow(i,MOD-2);
    vector<ll> c(k+1,0);
    rep(i,n){
      rep(j,k+1){
        (c[j]+=b[i])%=MOD;
        b[i]=(b[i]*a[i]%MOD*e[j+1])%MOD;
      }
    }
    // rep(i,n){
    //   rep(j,k+1) (c[j]+=b[i][j])%=MOD;
    // }
    vector<ll> ans(k+1);
    ans[1]=1;
    rep(i,k){
      ans[i+2]=(ans[i+1]*(i+2))%MOD;
    }
    vector<ll> o(k,0);
    rep(i,k){
      rep(j,k+1){
        if (i+1-j<0) break;
        (o[i]+=c[j]*c[i+1-j]%MOD)%=MOD;
      }
    }
    vector<ll> p(k+2,0);
    ll cc;
    rep(i,n){
      cc=a[i]*2;
      rep(j,k) {
        (p[j]+=cc)%=MOD;
        (cc*=a[i]*2)%=MOD;
      }
    }
    rep(i,k) cout << ((ans[i+1]*o[i]%MOD+MOD-p[i])%MOD)*Pow(2,MOD-2)%MOD << endl;
}
