#include <bits/stdc++.h>
using namespace std;
int As[110000];
int main() {
  int N, M;
  long long c;
  scanf("%d %d", &N, &M);
  As[0] = 0;
  for (int i = 0; i < N; i++) {
    int t;
    scanf("%d", &t);
    As[i + 1] = (As[i] + t) % M;
  }
  c = 0;
  for (int l = 0; l < N; l++) {
    for (int r = l + 1; r < N + 1; r++) {
      if ((As[r] - As[l] + M) % M == 0) c++;
    }
  }
  printf("%lld\n", c);
}
