#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
const ll MOD = 1000000007;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define coutALL(x) for(auto i=x.begin();i!=--x.end();i++) cout<<*i<<" ";cout<<*--x.end()<<endl;
#define coutVEC2(x) rep(j, x.size()) {auto y=x.at(j); coutALL(y);}
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; }

int main(){
	ll n, ans=0;
	cin>>n;
	vector<ll> a(n);
	rep(i,n) cin>>a[i];

	vector<ll> memo(200);
	rep(i, n){
		memo[a[i]%200]++;
	}
	// coutALL(memo);

	rep(i, 200){
		if(memo[i]!=0){
			ans += memo[i]*(memo[i]-1)/2;
		}
	}
	cout<<ans<<endl;
	return 0;
}
// This code wrote by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
#define int long long
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset(x,y,sizeof x)
#define sz(x) (int)(x).size()
#define ln puts("")
#define lsp putchar(32)
#define pb push_back
#define MP make_pair
#define dbg(x) cerr<<">"<<__func__<<"\tLine: "<<__LINE__<<' '<<#x<<": "<<x<<endl
using namespace std;
template <class t> inline void read(t &s){s=0;
reg int f=1;reg char c=getchar();while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c))s=(s<<3)+(s<<1)+(c^48),c=getchar();s*=f;return;}
template<class t,class ...A> inline void read(t &x,A &...a){read(x);read(a...);}
template <class t> inline void write(t x){if(x<0)putchar('-'),x=-x;
int buf[21],top=0;while(x)buf[++top]=x%10,x/=10;if(!top)buf[++top]=0;
while(top)putchar(buf[top--]^'0');return;}
inline void setIn(string s){freopen(s.c_str(),"r",stdin);return;}
inline void setOut(string s){freopen(s.c_str(),"w",stdout);return;}
inline void setIO(string s=""){setIn(s+".in");setOut(s+".out");return;}
template <class t>inline bool checkmin(t&x,t y){if(x>y){x=y;return 1;}return 0;}
template <class t>inline bool checkmax(t&x,t y){if(x<y){x=y;return 1;}return 0;}
inline int lowbit(int x){return x&(-x);}
set<int> S;
int n,T,lim;
int a[45];
inline void dfs(int dep,int sum)
{
	if(dep>lim)
	{
		S.insert(sum);
		return;
	}
	dfs(dep+1,sum);
	dfs(dep+1,sum+a[dep]);
	return;
}
int ans;
inline void dfs2(int dep,int sum)
{
	if(dep>n)
	{
		set<int>::iterator it=S.upper_bound(T-sum);
		if(it!=S.begin())
		{
			--it;
			checkmax(ans,sum+*it);
		}
		return;
	}
	dfs2(dep+1,sum);
	dfs2(dep+1,sum+a[dep]);
	return;
}
signed main(void)
{
	read(n,T);
	for(int i=1;i<=n;++i)
		read(a[i]);
	if(n==1)
	{
		if(a[1]<=T)
			write(a[1]);
		else
			write(0);
		ln;
		return 0;
	}
	lim=((n+1)>>1);
	dfs(1,0);
	dfs2(lim+1,0);
	write(ans),ln;
	return 0;
}

/*
 * Check List:
 * 1. Input / Output File (USACO and OI and UVa)
 * 2. long long 
 * 3. Special Test such as n=1
 * 4. Array Size
 * 5. Memory Limit (OI) int is 4 and longlong is 8
 * 6. Mod (a*b%p*c%p not a*b*c%p  ,  (a-b+p)%p not a-b )
 * 7. Name ( int k; for(int k...))
 * 8. more tests , (T=2 .. more)
 * 9. blank \n after a case
*/



