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