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