#include <bits/stdc++.h>
#include <fstream>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF=2147483647;
// 9,223,372,036,854,775,807
const ll INFL = 9223372036854775807;

bool func(const pair<ll,ll> &x,const pair<ll,ll> &y){
    if(x.second<y.second) return true;
    else return false;
}

int main(){

    ll n,k;
    cin >> n >> k;
    vector<deque<ll>> a_dequev(n+1);
    vector<ll> a_v(n);
    for(int i=0;i<n;i++){
        cin >> a_v[i];
    }
    sort(a_v.begin(),a_v.end());
    for(int i=0;i<n;i++){
        a_dequev[a_v[i]].push_back(a_v[i]);
    }
    ll sumpart = 0;
    ll ans = 0;
    int i = 0;
    int kchk = 0;
    for(int i=0;i<n;i++){
        if(a_dequev[i].empty() == false){
            a_dequev[i].pop_front();
            sumpart++;
        }
        else{
            if(i==0) break;
            kchk++;
            if(kchk>k) break;
            ans += sumpart;
            sumpart = 0 ;
            i = -1;
        }
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int mod = 1e9 + 7;
int mul(int a, int b) {
    ll ans = a * 1ll * b;
    return ans % mod;
}
int inv(int i) {
    int temp = mod - 2;
    int ans = 1;
    while (temp) {
        if (temp & 1) {
            ans = mul(ans, i);
        }
        temp >>= 1;
        i = mul(i, i);
    }
    return ans;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int s = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s += a[i];
    }
    int t = m - s;
    if (t < 0) {
        cout << 0 << endl;
        return 0;
    }
    int up = 1, down = 1;
    for (int i = 1; i <= s + n; i++) {
        up = mul(i + t, up);
        down = mul(i, down);
    }
    int ans = mul(up, inv(down));
    cout << ans << endl;
    return 0;
}