#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  long M;
  cin >> N >> M;
  long A[100010];
  A[0] = 0;
  long tmp;
  long long cnt;
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    A[i + 1] = (A[i] + tmp) % M;
  }
  for (int l = 1; l <= N; l++) {
    for (int r = l; r <= N; r++) {
      if (A[r] == A[l - 1]) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
