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