#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;


int main(){
	ll n,m;
	cin>>n>>m;
    ll a[n];
    rep(i,0,n)cin>>a[i];
    ll ans=0;
    ll st[n+1]={0};
    rep(i,1,n+1){
        st[i]=st[i-1]+a[i-1];
        st[i]%=m;
    }
    rep(i,0,n){
        rep(j,i+1,n+1){
            ll fuck=st[j]-st[i];
            if(fuck%m==0) ans++;
        }
    }
    cout<<ans;
}