/*
f[n][k] = f[n - 1][k - 1] + f[n][2k]
*/

#include <cstdio>
#include <algorithm>

const int N = 3000 + 10;
const int MOD = 998244353;

int n, m;
int f[N][N << 1];

inline int qmod(int x) { return (x>=MOD)?(x-MOD):x; }

int main() {
	int i, j;
	
	scanf("%d %d", &n, &m);
	
	f[0][0] = 1;
	for(i=1; i<=n; i++) 
		for(j=i; j; j--)
			f[i][j] = qmod(f[i - 1][j - 1] + f[i][j << 1]);
	printf("%d\n", f[n][m]);
	return 0;
}
#include <bits/stdc++.h>

#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb push_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#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 = 3e5 + 5;
int n,k,cnt[MAXN];

int main(){
    scanf("%d%d",&n,&k);
    FOR(i,1,n){
        int x;scanf("%d",&x);++cnt[x];
    }
    int rem = k;LL ans = 0;
    FOR(i,0,n-1){
        rem = std::min(rem,cnt[i]);
        ans += rem;
    }
    printf("%lld\n",ans);
    return 0;
}
