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