#include <bits/stdc++.h>
using namespace std;
long long N, M;
vector<long long> A(100001, 0);
vector<long long> v(100001, 0);
int main(void) {
  cin >> N >> M;
  for (int i = 0; i < N; ++i) cin >> A[i];
  long long n = 0;
  for (int i = 0; i < N; ++i) n += A[i], v[i] = n;
  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      if (i == 0) {
        if (v[j] % M == 0) ++ans;
      } else {
        if ((v[j] - v[i - 1]) % M == 0) ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
