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