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