#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;

int main()
{
    ll n,a,i,j,k;
    cin>>n>>a;
    ll x[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>x[i];
    }
    ll dp[51][51][2501];
    for(i=0;i<=2500;i++)
    {
        dp[0][0][i] = 0;
    }
    for(i=1;i<=n;i++)
    {
        for(k=0;k<=2500;k++)
        {
            ll count = 0;
            for(j=1;j<=i;j++)
            {
                if(x[j]==k)
                    count++;
            }
            dp[i][1][k] = count;
        }
    }
    for(i=2;i<=n;i++)
    {
        for(j=2;j<=i;j++)
        {
            for(k=0;k<=2500;k++)
            {
                dp[i][j][k] = max(dp[i][j][k],dp[i-1][j][k]+dp[i-1][j-1][max(0LL,k-x[i])]);
                /*if(dp[i][j][k]>0 && j==2 && k==8)
                {
                    cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<endl;
                }*/
            }
        }
    }
    ll ans = 0;
    for(i=1;i<=n;i++)
    {
        ans += dp[n][i][a*i];
        // cout<<dp[n][i][a*i]<<" ";
    }
    cout<<ans<<endl;
    return 0;
}
