#include <bits/stdc++.h>
using namespace std;
using ui64 = unsigned long long;
using i64 = long long;
const int MAX_N = 100000;
ui64 dp[MAX_N + 1];
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  memset(dp, 0, sizeof(dp));
  for (int r = 1; r < N + 1; ++r) {
    dp[r] = dp[r - 1] + A[r - 1];
  }
  ui64 ans = 0;
  for (int l = 0; l < N; ++l) {
    for (int r = l + 1; r < N + 1; ++r) {
      if ((dp[r] - dp[l]) % M == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
