#include<bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = 1 << 29;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const int MAX_V = 500;
const ll mod9 = 998244353;
const ll MAX = 2100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p)
{ cout << "(" << p.first << ", " << p.second << ")"; return os; }
template <class T, class S> istream& operator>>(istream& os,  pair<T, S>& p)
{ os >> p.first >> p.second; return os; }
template <class T> ostream &operator<<(ostream &os, const vector<T> &v)
{ for (auto &e : v){cout << e << " ";}cout << endl;return os; }
template<class T> ostream& operator << (ostream &os, set<T> P)
{ for(auto it : P) { os << "<" << it << "> "; } return os << endl; }
template<class T1, class T2> ostream& operator << (ostream &os, map<T1,T2> P)
{ for(auto it : P) { os << "<" << it.first << "->" << it.second << "> "; } return os << endl; }




ll n, X;
ll A[60];
map<pll, ll> mp;

ll f(int x, int i){
    if(mp[{x, i}] > 0) return mp[{x,i}];
    if(i == n - 1) return (x >= 0);
    ll a = A[i], b = A[i+1];
    // assert( x % a == 0);
    if( x % b == 0){
        mp[{x, i}] = f(x, i+1);
        return mp[{x, i}];
    }
    ll y = x - x % b;
    mp[{x, i}] = f(y, i+1) + f(y + b, i + 1);
    return mp[{x, i}];
}



void solve() {
    cin>>n>>X;
    rep(i,n) cin>>A[i];
    cout<<f(X, 0)<<endl;
}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    ll t=1;
    
    // cin>>t;

    rep(i,t){
        solve(); 
    }

    return 0;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <chrono>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=a;i<b;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,a) rrepi(i,a,0)
#define rrepi(i,a,b) for(ll i=a-1;i>=b;--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<int,int> pi;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<double,double> point;
typedef complex<double> Point;
typedef string::const_iterator State;
const ll MAX = 105;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};

//1-indexed
class BIT{
    private:
        vector<ll> bit;
        ll size;
    public:
        BIT(ll n){
            bit.resize(n+1);
            size = n;
        }
        ll sum(ll i){
            ll res = 0;
            while(i > 0){
                res += bit[i];
                i -= i&-i;
            }
            return res;
        }
        void add(ll i,ll x){
            while(i <= size){
                bit[i] += x;
                i += i&-i;
            }
        }
};

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    cins(all(a));
    BIT v1(n),v2(n);
    vector<ll> cnt1(n,0),cnt2(n,0),s1(n),s2(n);
    ll s = 0;
    rep(i,n){
        s1[i] = v1.sum(a[i]+1);
        s += v1.sum(a[i]+1);
        cnt1[i] = i*(i+1)/2-s;
        v1.add(a[i]+1,1);
    }
    s = 0;
    rep(i,n){
        s2[i] = i-v2.sum(a[n-i-1]+1);
        s += v2.sum(a[n-i-1]+1);
        cnt2[i] = s;
        v2.add(a[n-i-1]+1,1);
    }
    ll k = cnt2[n-1];
    //array_output(all(cnt1));
    //array_output(all(cnt2));
    //array_output(all(s1));
    //array_output(all(s2));
    rep(i,n){
        PRINT(k);
        if (i < n-1){
            k -= n-i-1-s2[n-i-1];
            k -= s1[i];
            k += s2[n-i-1];
            k += i-s1[i];
        }
    }
}
