#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N, M) for (ll i = N; i < M; ++i)
#define rrep(i, N, M) for (ll i = N; i < M; --i)
#define pb push_back



typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef priority_queue<pll, vector<pll>, greater<pll>> greater_pq;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>

template<class T, class S>
T atbit(T n, S i) {
	return (n >> i) % i;
}
template<class T>
T getbit( T i) {
	return 1LL<<i;
}

using namespace std;

ll A[100100] = { 0LL };
ll sum[100100] = { 0LL };

int main() {
	ll N, M;
	cin >> N >> M;
	//vll A(N),sum(N+1,0);
	rep(i, 0, N) {
		//cin >> A[i];
		scanf_s("%d", &A[ i]);
		sum[i+1] += (i>0?sum[i]:0)+A[i];
		
	}
	ll cnt = 0LL;
	rep(l, 0, N) {
		rep(r,l, N) {
			if ((sum[r + 1] - sum[l])%M==0) {
				++cnt;
			}
		}
	}
	cout << cnt;
}
