#include<stdio.h>
#include<algorithm>
#define ll long long
int N;
ll M,cnt=0;
const int maxn=1e6+5;
ll a[maxn],pre[maxn]={0};
int main()
{
    scanf("%d%lld",&N,&M);
    for(int i=1;i<=N;i++)
    {
        scanf("%lld",&a[i]);
        pre[i]=pre[i-1]+a[i];
    }
    for(int i=0;i<N;i++)
        for(int j=i+1;j<=N;j++)
        {
            if((pre[j]-pre[i])%M==0)
                cnt++;
        }
    printf("%lld\n",cnt);
    return 0;
}
