#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
#include<map>
#include<cctype>
#include<sstream>
using namespace std;
int a[100050];
__int64 sum;
int main()
{
	ios::sync_with_stdio(false);
	int n,m;
	cin >> n >> m;
	for (int i = 0;i < n;i++)
		cin >> a[i];
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = i; j < n; j++)
		{
			sum = 0;
			for (int k = i;k <= j;k++)
			{
				sum += a[k];
			}
			if (sum%m == 0)
				ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

