#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long N, M;
  cin >> N >> M;
  long long num[N];
  for (long long i = 0; i < N; i++) {
    cin >> num[i];
  }
  long long sum;
  int ans = 0;
  for (long long j = 0; j < N; j++) {
    for (long long k = 0; k + j < N; k++) {
      sum = 0;
      for (long long l = j; l < k + j + 1; l++) {
        sum = sum + num[l];
      }
      if (sum % M == 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
