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