#include <bits/stdc++.h>
using namespace std;
int n, m, a[100001], x[100001], i, j, z;
int main() {
  cin >> n >> m;
  x[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    x[i] = a[i] + x[i - 1];
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j < i; j++) {
      if ((x[i] - x[j]) % m == 0) z++;
    }
  }
  cout << z;
  return 0;
}
