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