#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, sum[100000 + 1];
  int m;
  long ans = 0;
  cin >> n >> m;
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    long tmp;
    cin >> tmp;
    sum[i] = (tmp + sum[i - 1]) % m;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      if ((sum[i] - sum[j - 1]) % m == 0) ans++;
    }
  }
  cout << ans << endl;
}
