#include <bits/stdc++.h>
using namespace std;
const int INF = ((1LL << 30) + (1LL << 29));
const long long MOD = 1000000007;
int N, M;
vector<int> A;
void input() {
  cin >> N >> M;
  A = vector<int>(N);
  for (int i = 0; i < (int)(N); ++i) {
    cin >> A[i];
  }
}
void solve() {
  vector<long long> Aac(N + 1);
  Aac[0] = 0;
  for (int i = 0; i < N; ++i) {
    Aac[i + 1] = Aac[i] + A[i];
  }
  int cnt = 0;
  for (int l = 1; l <= N; ++l) {
    for (int r = l; r <= N; ++r) {
      if ((Aac[r] - Aac[l - 1]) % M == 0) {
        ++cnt;
      }
    }
  }
  cout << cnt << endl;
}
signed main() {
  input();
  solve();
  return 0;
}
