#include <bits/stdc++.h>
using namespace std;
long long data[100005], sum[100005], ans, n, m;
int main() {
  scanf("%lld%lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &data[i]);
    sum[i] += sum[i - 1] + data[i];
    if (sum[i] % m == 0) ans++;
  }
  for (int i = n; i > 1; i--) {
    for (int j = 1; j < i; j++)
      if ((sum[i] - sum[j]) % m == 0) ans++;
  }
  printf("%lld\n", ans);
  return 0;
}
