#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  int A[10010];
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    A[i] = tmp;
  }
  long ans = 0;
  for (int l = 0; l < N; l++) {
    for (int r = l; r < N; r++) {
      int sum = 0;
      bool flag = false;
      for (int k = l; k <= r; k++) {
        sum += A[k];
      }
      if (sum % M == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
