#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,k;
    cin>>n>>k;
    vector<int>cnt(n+1);
    for(int i=0;i<n;i++){
        int a;cin>>a;
        cnt[a]++;
    }
    int ans=0;
    int lst=k;
    for(int i=0;i<=n;i++){
        if(cnt[i]==0)break;

        lst=min(lst,cnt[i]);

        ans+=lst;
    }
    cout<<ans<<'\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for (int i = (m); i < (int)(n); i++)
using ll = long long;
using vl = vector<ll>;
using P = pair<ll, int>;


ll solve(vl& A, map<P, ll>& m, ll x, int i) {
    if (i == int(A.size()) - 1) return 1;
    if (m.count(P(x, i))) return m[P(x, i)];
    ll d = x % A[i + 1];
    ll ret = solve(A, m, x - d, i + 1);
    if (d > 0) ret += solve(A, m, x + (A[i + 1] - d), i + 1);
    return m[P(x, i)] = ret;
}


int main() {
    // input
    ll N, X;
    cin >> N >> X;
    vl A(N);
    rep(i, N) cin >> A[i];

    // solve
    map<P, ll> m;
    ll ans = solve(A, m, X, 0);
    cout << ans << endl;
}
