#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  long long count = 0;
  cin >> N >> M;
  long long box[N];
  for (long long i = 0; i < N; i++) cin >> box[i];
  for (long long l = 0; l < N; l++) {
    long long a = box[l];
    for (long long r = l; r < N; r++) {
      a += box[r];
      if (a % M == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
